@@ -381,56 +381,47 @@ export function historySyncPlugin<
381381
382382 for ( const activity of stack . activities ) {
383383 if (
384- activity . transitionState === "enter-done " ||
385- activity . transitionState === "enter-active "
384+ activity . transitionState === "enter-active " ||
385+ activity . transitionState === "enter-done "
386386 ) {
387387 const match = activityRoutes . find (
388388 ( r ) => r . activityName === activity . name ,
389389 ) ! ;
390390 const template = makeTemplate ( match , options . urlPatternOptions ) ;
391391
392392 if ( activity . isRoot ) {
393- requestHistoryTick ( ( ) => {
394- silentFlag = true ;
395- replaceState ( {
396- history,
397- pathname : template . fill ( activity . params ) ,
398- state : {
399- activity : activity ,
400- step : activity . steps [ 0 ] ,
401- } ,
402- useHash : options . useHash ,
403- } ) ;
393+ replaceState ( {
394+ history,
395+ pathname : template . fill ( activity . params ) ,
396+ state : {
397+ activity : activity ,
398+ step : activity . steps [ 0 ] ,
399+ } ,
400+ useHash : options . useHash ,
404401 } ) ;
405402 } else {
406- requestHistoryTick ( ( ) => {
407- silentFlag = true ;
403+ pushState ( {
404+ history,
405+ pathname : template . fill ( activity . params ) ,
406+ state : {
407+ activity : activity ,
408+ step : activity . steps [ 0 ] ,
409+ } ,
410+ useHash : options . useHash ,
411+ } ) ;
412+ }
413+
414+ for ( const step of activity . steps ) {
415+ if ( ! step . exitedBy && step . enteredBy . name !== "Pushed" ) {
408416 pushState ( {
409417 history,
410- pathname : template . fill ( activity . params ) ,
418+ pathname : template . fill ( step . params ) ,
411419 state : {
412420 activity : activity ,
413- step : activity . steps [ 0 ] ,
421+ step : step ,
414422 } ,
415423 useHash : options . useHash ,
416424 } ) ;
417- } ) ;
418- }
419-
420- for ( const step of activity . steps ) {
421- if ( ! step . exitedBy && step . enteredBy . name !== "Pushed" ) {
422- requestHistoryTick ( ( ) => {
423- silentFlag = true ;
424- pushState ( {
425- history,
426- pathname : template . fill ( activity . params ) ,
427- state : {
428- activity : activity ,
429- step : step ,
430- } ,
431- useHash : options . useHash ,
432- } ) ;
433- } ) ;
434425 }
435426 }
436427 }
0 commit comments