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

route-changed fired twice with bad state #245

Open
tjb1982 opened this issue Apr 24, 2019 · 1 comment
Open

route-changed fired twice with bad state #245

tjb1982 opened this issue Apr 24, 2019 · 1 comment

Comments

@tjb1982
Copy link

tjb1982 commented Apr 24, 2019

I'm experiencing a problem where when there were queryParams before navigating to a new URL without query params, route-changed is dispatched twice, the first time around with bad state (i.e., contains the old queryParams).

E.g., start with URL:

/context/?param=foo

route-changed is dispatched:

appRout.queryParams === {param: "foo"}

user clicks on <a href="/context">...</a>, and route-changed is dispatched:

appRoute.queryParams === {param: "foo"}

but then route-changed is immediately dispatched a second time:

appRoute.queryParams === {}

The work-around I'm using is wrapping my route-changed event handler in a 0ms-debounce, which allows the event loop to recycle and finish the required mutations to the state of the queryParams. However, route-changed is still dispatched twice.

@dman777
Copy link

dman777 commented Dec 15, 2019

I am hitting this also

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

No branches or pull requests

2 participants