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

Remove old navigation listeners when reloading #8

Merged
merged 1 commit into from
Sep 1, 2018

Conversation

mjenssen
Copy link
Contributor

@mjenssen mjenssen commented Sep 1, 2018

When reloading, the old popstate/hashchange event listeners were not removed so every time you reloaded you got one extra event when navigating.

I don't know if this is related or not, but I had some issues where the virtual DOM got strange after a hot reload (essentially, parts of the DOM would be duplicated when navigating). A workaround for this was to make the top level nodes keyed. However, after removing the event listeners, I no longer experience this.

@klazuka
Copy link
Owner

klazuka commented Sep 1, 2018

Good find. Chrome dev tools confirmed the bug (unbounded growth in event listeners after HMR):

before

And after your fix:

after

Thank you!

@klazuka klazuka merged commit 3372608 into klazuka:master Sep 1, 2018
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.

2 participants