File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @solidjs/router " : patch
3
+ ---
4
+
5
+ Fix state updates detection on history back/forward
Original file line number Diff line number Diff line change 7
7
createSignal ,
8
8
on ,
9
9
onCleanup ,
10
- onMount ,
11
10
untrack ,
12
11
useContext ,
13
12
startTransition ,
@@ -327,9 +326,11 @@ export function createRouterContext(
327
326
}
328
327
} ;
329
328
330
- const handlePopState = ( ) => setState ( window . history . state ) ;
331
- onMount ( ( ) => window . addEventListener ( "popstate" , handlePopState ) ) ;
332
- onCleanup ( ( ) => window . removeEventListener ( "popstate" , handlePopState ) ) ;
329
+ if ( ! isServer ) {
330
+ const syncState = ( ) => setState ( window . history . state ) ;
331
+ window . addEventListener ( "popstate" , syncState ) ;
332
+ onCleanup ( ( ) => window . removeEventListener ( "popstate" , syncState ) ) ;
333
+ }
333
334
334
335
createRenderEffect ( ( ) => {
335
336
const { value, state } = source ( ) ;
You can’t perform that action at this time.
0 commit comments