diff --git a/.changeset/sour-horses-protect.md b/.changeset/sour-horses-protect.md new file mode 100644 index 00000000..68e9701b --- /dev/null +++ b/.changeset/sour-horses-protect.md @@ -0,0 +1,5 @@ +--- +"@stackflow/plugin-history-sync": patch +--- + +fix(plugin-history-sync): fix history queue on init diff --git a/extensions/plugin-history-sync/src/historySyncPlugin.tsx b/extensions/plugin-history-sync/src/historySyncPlugin.tsx index e7b0ca69..a2f3e773 100644 --- a/extensions/plugin-history-sync/src/historySyncPlugin.tsx +++ b/extensions/plugin-history-sync/src/historySyncPlugin.tsx @@ -164,17 +164,15 @@ export function historySyncPlugin< const lastStep = last(rootActivity.steps); - requestHistoryTick(() => - replaceState({ - history, - pathname: template.fill(rootActivity.params), - state: { - activity: rootActivity, - step: lastStep, - }, - useHash: options.useHash, - }), - ); + replaceState({ + history, + pathname: template.fill(rootActivity.params), + state: { + activity: rootActivity, + step: lastStep, + }, + useHash: options.useHash, + }); const onPopState: Listener = (e) => { if (silentFlag) { @@ -273,11 +271,9 @@ export function historySyncPlugin< ) { const { enteredBy } = targetStep; - requestHistoryTick(() => { - pushFlag += 1; - stepPush({ - ...enteredBy, - }); + pushFlag += 1; + stepPush({ + ...enteredBy, }); }