Skip to content

Commit

Permalink
fix(plugin-history-sync): request history tick on init (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
orionmiz authored Jan 22, 2024
1 parent 4c4b1ab commit 99c34fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/small-pears-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stackflow/plugin-history-sync": patch
---

fix(plugin-history-sync): request history tick on init
20 changes: 11 additions & 9 deletions extensions/plugin-history-sync/src/historySyncPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,17 @@ export function historySyncPlugin<

const lastStep = last(rootActivity.steps);

replaceState({
history,
pathname: template.fill(rootActivity.params),
state: {
activity: rootActivity,
step: lastStep,
},
useHash: options.useHash,
});
requestHistoryTick(() =>
replaceState({
history,
pathname: template.fill(rootActivity.params),
state: {
activity: rootActivity,
step: lastStep,
},
useHash: options.useHash,
}),
);

const onPopState: Listener = (e) => {
if (silentFlag) {
Expand Down

1 comment on commit 99c34fa

@vercel
Copy link

@vercel vercel bot commented on 99c34fa Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.