File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed
packages/electron-trpc/src/main Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' electron-trpc ' : minor
3+ ---
4+
5+ Fix bug where soft-navigation events would cause subscription cleanup
Original file line number Diff line number Diff line change @@ -79,16 +79,19 @@ class IPCHandler<TRouter extends AnyRouter> {
7979 }
8080
8181 #attachSubscriptionCleanupHandlers( win : BrowserWindow ) {
82- win . webContents . on ( 'did-start-navigation' , ( { frame } ) => {
83- debug (
84- 'Handling webContents `did-start-navigation` event' ,
85- `webContentsId: ${ win . webContents . id } ` ,
86- `frameRoutingId: ${ frame . routingId } `
87- ) ;
88- this . #cleanUpSubscriptions( {
89- webContentsId : win . webContents . id ,
90- frameRoutingId : frame . routingId ,
91- } ) ;
82+ win . webContents . on ( 'did-start-navigation' , ( { isSameDocument, frame } ) => {
83+ // Check if it's a hard navigation
84+ if ( ! isSameDocument ) {
85+ debug (
86+ 'Handling hard navigation event' ,
87+ `webContentsId: ${ win . webContents . id } ` ,
88+ `frameRoutingId: ${ frame . routingId } `
89+ ) ;
90+ this . #cleanUpSubscriptions( {
91+ webContentsId : win . webContents . id ,
92+ frameRoutingId : frame . routingId ,
93+ } ) ;
94+ }
9295 } ) ;
9396 win . webContents . on ( 'destroyed' , ( ) => {
9497 debug ( 'Handling webContents `destroyed` event' ) ;
You can’t perform that action at this time.
0 commit comments