@@ -20,26 +20,30 @@ export function useSessionRefreshEffects(input: {
2020 let todoTimer : number | undefined
2121
2222 const emitRefresh = ( event : RendererDiagnosticInput ) => {
23- void input . emitRendererDiagnostic ?.( event )
23+ try {
24+ const pending = input . emitRendererDiagnostic ?.( event )
25+ void Promise . resolve ( pending ) . catch ( ( ) => undefined )
26+ } catch { }
2427 }
2528
2629 const syncSessionWithDiagnostics = ( id : string , options : { force ?: boolean } | undefined , cachePresent : boolean ) => {
2730 const startedAt = performance . now ( )
31+ const visibleSessionID = input . timelineSessionID ( )
2832 const phase = options ?. force ? "message_force" : "message"
2933 emitRefresh ( {
3034 name : "session.data.refresh" ,
3135 route_session_id : id ,
32- visible_session_id : input . timelineSessionID ( ) ,
33- timeline_session_id : input . timelineSessionID ( ) ,
36+ visible_session_id : visibleSessionID ,
37+ timeline_session_id : visibleSessionID ,
3438 data : { phase : `${ phase } _start` , cache_present : cachePresent } ,
3539 } )
3640 void Promise . resolve ( input . syncSession ( id , options ) )
3741 . then ( ( ) => {
3842 emitRefresh ( {
3943 name : "session.data.refresh" ,
4044 route_session_id : id ,
41- visible_session_id : input . timelineSessionID ( ) ,
42- timeline_session_id : input . timelineSessionID ( ) ,
45+ visible_session_id : visibleSessionID ,
46+ timeline_session_id : visibleSessionID ,
4347 data : {
4448 phase : `${ phase } _end` ,
4549 duration_ms : Math . round ( performance . now ( ) - startedAt ) ,
@@ -51,8 +55,8 @@ export function useSessionRefreshEffects(input: {
5155 emitRefresh ( {
5256 name : "session.data.refresh" ,
5357 route_session_id : id ,
54- visible_session_id : input . timelineSessionID ( ) ,
55- timeline_session_id : input . timelineSessionID ( ) ,
58+ visible_session_id : visibleSessionID ,
59+ timeline_session_id : visibleSessionID ,
5660 data : {
5761 phase : `${ phase } _failed` ,
5862 duration_ms : Math . round ( performance . now ( ) - startedAt ) ,
@@ -64,10 +68,11 @@ export function useSessionRefreshEffects(input: {
6468
6569 const syncTodoWithDiagnostics = ( id : string , options : { force ?: boolean } | undefined , cachePresent : boolean ) => {
6670 const startedAt = performance . now ( )
71+ const routeSessionID = input . routeSessionID ( )
6772 const phase = options ?. force ? "todo_force" : "todo"
6873 emitRefresh ( {
6974 name : "session.data.refresh" ,
70- route_session_id : input . routeSessionID ( ) ,
75+ route_session_id : routeSessionID ,
7176 visible_session_id : id ,
7277 timeline_session_id : id ,
7378 data : { phase : `${ phase } _start` , cache_present : cachePresent } ,
@@ -76,7 +81,7 @@ export function useSessionRefreshEffects(input: {
7681 . then ( ( ) => {
7782 emitRefresh ( {
7883 name : "session.data.refresh" ,
79- route_session_id : input . routeSessionID ( ) ,
84+ route_session_id : routeSessionID ,
8085 visible_session_id : id ,
8186 timeline_session_id : id ,
8287 data : {
@@ -89,7 +94,7 @@ export function useSessionRefreshEffects(input: {
8994 . catch ( ( ) => {
9095 emitRefresh ( {
9196 name : "session.data.refresh" ,
92- route_session_id : input . routeSessionID ( ) ,
97+ route_session_id : routeSessionID ,
9398 visible_session_id : id ,
9499 timeline_session_id : id ,
95100 data : {
0 commit comments