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

window.onpopstate is null error in fire() #229

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

Conversation

staeke
Copy link

@staeke staeke commented Apr 1, 2014

Better handling of cases where there's a race condition on start, setRoute called before onpopstate is set. When fire is triggered (e.g. through setRoute) an error occurs if we haven't set onpopstate. Thus, make sure to record any fire calls, set onpopstate as soon as DOM is ready (+1 event loop), and then resume, possibly triggering a recorded fire call.

Staffan Eketorp added 2 commits April 1, 2014 11:35
…Route called before onpopstate is set. When fire is triggered (e.g. through setRoute) an error occurs if we haven't set onpopstate. Thus, make sure to record any fire calls, set onpopstate as soon as DOM is ready (+1 event loop), and then resume, possibly triggering a recorded fire
@staeke
Copy link
Author

staeke commented May 6, 2014

Did you guys have an opinion on this. Would appreciate either a merge or a comment.

@beaugunderson
Copy link
Contributor

Hey @staeke, I'm helping to maintain this library now. Do you have an example of how to reproduce the undesired behavior? I can help to create a test case if so and then will work to get this merged.

…y quickly after first router initialisation.
@minrwhite
Copy link

@beaugunderson I have also had problems caused by this so thought I'd contribute. See staeke#1 for a test that will both demonstrate the problem and the efficacy of the solution proposed by @staeke

Benjamin White and others added 2 commits June 26, 2014 10:43
Unit test to demonstrate onpopstate failure when navigating very quickly
@jabjab
Copy link

jabjab commented Apr 29, 2015

I'm encountering this in mobile Safari as well when setRoute is called right after init.

@cmwelsh
Copy link

cmwelsh commented Apr 29, 2015

I fixed this one a little differently:

#279

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.

5 participants