Skip to content

Commit

Permalink
fix(plugin-history-sync): fix history queue on init (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
orionmiz committed Jan 16, 2024
1 parent ed530cf commit f3b2d72
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/sour-horses-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stackflow/plugin-history-sync": patch
---

fix(plugin-history-sync): fix history queue on init
28 changes: 12 additions & 16 deletions extensions/plugin-history-sync/src/historySyncPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -273,11 +271,9 @@ export function historySyncPlugin<
) {
const { enteredBy } = targetStep;

requestHistoryTick(() => {
pushFlag += 1;
stepPush({
...enteredBy,
});
pushFlag += 1;
stepPush({
...enteredBy,
});
}

Expand Down

1 comment on commit f3b2d72

@vercel
Copy link

@vercel vercel bot commented on f3b2d72 Jan 16, 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.