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

Router renders components twice with hash history #148

Open
wmaurer opened this issue Oct 7, 2016 · 0 comments
Open

Router renders components twice with hash history #148

wmaurer opened this issue Oct 7, 2016 · 0 comments

Comments

@wmaurer
Copy link
Contributor

wmaurer commented Oct 7, 2016

With HTML5 History API, the user agent fires a popstate event when the user navigates through their history, whether backwards or forwards, provided it isn’t taking the user away from the current page:
http://html5doctor.com/history-api/#historical-events

As far as I understand it, this means that when using hash history - createHashHistory(), both a PUSH and a POP emitted.

@cycle/history also emits both of these events. You can see this by adding a debug to history$ in RouterSource, e.g. on line 39 of RouterSource.ts (when using the hash history).

However I believe it should be up to cyclic-router to filter out the POPs. The unfortunate consequence of getting both events is that components are rendered twice on every route change (when using hash history).

What do you think @TylorS?

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

1 participant