Open PaulMaly opened 5 years ago
@matthewp Any news here? Is this patch reasonable?
It's hard to keep all of this in my head correctly. We've had a lot of modification of this part of the code. I'm a little bit afraid that we're playing bug whack-a-mole. We fix one thing but break something else. To prevent that going forward I feel we really need tests for each PR. So if you can add a test for this case then I think it's good to go.
@matthewp I believe it's a very obvious case to be tested. Seems we should trigger _onpopstate
somehow any way in all possible cases. There's the case when _onpopstate
never be triggered:
page.start({
popstate: false,
hashbang: true,
});
Because we've only two places where _onpopstate
method could be triggered:
and
if(this._hashbang && hasWindow && !hasHistory)
So, in a case when we've history and don't want to popstate, _onpopstate
method will never be triggered.
It's very bad because if in this case, we'll press the browser back button, the router won't be informed about location changed.
@matthewp Any thoughts?
Not on your last comment, no, sorry. But, what needs to happen is we need a test that verifies that a hashchange listener is added when { popstate: false }
, that much makes sense to me.
Seems we should add an event listener to
hashchange
ifpopstate
option equals false andhashbang
option equals true. In this case, right now back navigation viahistory.back()
not working.