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

fix blocking navigation when frequently switching between pages #3

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AnthonyXcode
Copy link

@AnthonyXcode AnthonyXcode commented Dec 13, 2024

Steps to produce the issue

  1. When two pages use useRouteChangeEvents
  2. The user switch between these two pages few times
  3. The user route to other pages which doesn't have useRouteChangeEvents
  4. All links in the app don't work

Root cause

update state actions is not in-sync, when we call request => revoke => request at the same time. Actually, the state inside the blocks are the same value but not update one by one.

How to fix

Use global variable to store the requests ID to make sure the changes is in order.

@run4w4y
Copy link
Owner

run4w4y commented Dec 13, 2024

Wow, thank you very much for this PR!
Unfortunately, I'm on an overseas trip away from home right now, I hope you don't mind if I'll take a look after I get back in a week or so.
Once again, really grateful for this contribution, since I've noticed the issue myself a few times but never bothered to look deeper into it

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 this pull request may close these issues.

3 participants