-
Notifications
You must be signed in to change notification settings - Fork 26
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
Consider cancelling pending forward navigations when going back #13
Comments
Could this be handled by the router itself? Or are you suggesting this is universally desirable? I think the router (which knows about pending navigations) should be responsible for cancelling the push navigations on a back click. I'm not convinced the framework itself should do this behavior. |
@tbondwilkinson I think this does need to be done by the platform because navigations come from multiple uncoordinated libraries on the page. I'm not sure I understand what you mean by |
I do think that most applications will choose to have one central |
@tbondwilkinson I think you're misunderstanding the ticket here. The spec provides no facility for that central navigate listener to inspect the pending navigation stack or to cancel a pending navigation. Calls to pushNewEntry() go into a queue you can't interact with. There's also no way to know when the sequence of navigate events comes in should you want to cancel them, and that starts to make the router abstraction fairly complex. I think requiring a sophisticated router that is observing all forward and backward navigation and picking and choosing what to cancel would be unfortunate and likely leads to a lot of buggy web apps compared to native. I don't think any real app jumps forward like this after going back. |
Sorry, I'm not being clear.
|
Part of my concern with this is that browsers have chosen different default behaviors for this exact use case today: https://docs.google.com/document/d/1Pdve-DJ1JCGilj9Yqf5HxRJyBKSel5owgOvUJqTauwU/edit This is certainly broken. I think the only two choices are making it explicit in the spec, and really spending the time to spell out every edge case, and then making tests to ensure all browsers are consistent, or just punting and making the application do the cancellation. But I'm starting to come-around to thinking that reasonable defaults is more desirable than making the application router do more work. Certainly less likely to be buggy, as you point out. |
Closes #38 by making it explicit that the stop button is meant to trigger the navigate event's AbortSignal. Closes #10 by getting rid of queued-up navigations, their associated event, and their associated callback variants to update() and push(). Instead, navigations during other navigations interrupt the ongoing one. As the new example tries to show, this seems to work pretty well. Closes #13 by canceling all pending navigations when another one starts, of which the case discussed there is one example.
Closes #38 by making it explicit that the stop button is meant to trigger the navigate event's AbortSignal. Closes #10 by getting rid of queued-up navigations, their associated event, and their associated callback variants to update() and push(). Instead, navigations during other navigations interrupt the ongoing one. As the new example tries to show, this seems to work pretty well. Closes #13 by canceling all pending navigations when another one starts, of which the case discussed there is one example.
Closes #38 by making it explicit that the stop button is meant to trigger the navigate event's AbortSignal. Closes #10 by getting rid of queued-up navigations, their associated event, and their associated callback variants to update() and push(). Instead, navigations during other navigations interrupt the ongoing one. As the new example tries to show, this seems to work pretty well. Closes #13 by canceling all pending navigations when another one starts, of which the case discussed there is one example.
Queued forward navigations should automatically cancel when executing a backwards navigation.
ex. In the photo gallery example:
The expected user behavior is not that the app goes back to /photos/1 and then jumps forward 9 times, but that all pending forward navigations are cancelled whenever going backwards.
I don't think this should be done manually through an AbortSignal. In practice the queued navigations are likely to come out of third party libraries or unrelated components.
The text was updated successfully, but these errors were encountered: