Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report(history-sync): Pop multiple and replace screen trigger history sync error. #381

Closed
SimYunSup opened this issue Mar 27, 2023 · 1 comment · Fixed by #410
Closed

Comments

@SimYunSup
Copy link
Contributor

SimYunSup commented Mar 27, 2023

Describe the Bug

Hi, I'm writing this issue because I encountered a bug while using a great library. I was using the history-sync plugin and when I pop multiple times and replace immediately through useFlow, history-sync throws an error.

// ...
                 <button
                    onClick={() => {
                        pop(2);
                        replace('Third', {})
                    }}
                >
                    Pop and replace Third
                </button>

Environment

OS: Windows 11 Firefox 111, Android Webview 111, iOS 16.3.1 Webview
package versions:

  "dependencies": {
    "@stackflow/core": "^1.0.4",
    "@stackflow/plugin-basic-ui": "^1.2.2",
    "@stackflow/plugin-history-sync": "^1.3.2",
    "@stackflow/plugin-renderer-basic": "^1.1.1",
    "@stackflow/react": "^1.1.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },

ScreenShot

Screen_Recording_20230327_174631_Parallels_Access.mp4
@SimYunSup
Copy link
Contributor Author

SimYunSup commented Mar 27, 2023

stackflow popped too fast, so this code triggers coreActions.pop after popped and replaced. I want to know why this code exist for.

const interval = setInterval(() => {
const nextStackValue = aggregate(events.value, new Date().getTime());
if (!isEqual(stack.value, nextStackValue)) {
setStackValue(nextStackValue);
}
if (nextStackValue.globalTransitionState === "idle") {
clearInterval(interval);
}
}, INTERVAL_MS);

This code triggers pop after popped multiple and replaced without history-sync-plugin, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant