-
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
appHistory.update async or not, and the effect on navigation cancellation #44
Comments
Heya, great question. I think I've flipped back and forth on this a few times, which is what led to the current inconsistent state you noticed. In general, the spec's current idea of making all navigations async so that they can be intercepted doesn't really work. We're figuring that out in #19, as you saw. The latest thinking there is that, generally, we'll update the URL/state/current entry immediately, let the potentially-async I think, given that, we should probably make both Although, see also the discussion #42 ... |
This includes ones generated by intercepting the navigate event with event.respondWith(). However, the promise passed to event.respondWith() is still useful for signaling the navigation's successful or unsuccessful completion. That is used to fuel browser UI, such as the loading spinner, as well as promises and events. And a rejected promise passed to event.respondWith() will roll back the navigation. Closes #19. Closes #44.
This includes ones generated by intercepting the navigate event with event.respondWith(). However, the promise passed to event.respondWith() is still useful for signaling the navigation's successful or unsuccessful completion. That is used to fuel browser UI, such as the loading spinner, as well as promises and events. And a rejected promise passed to event.respondWith() will roll back the navigation. Closes #19. Closes #44. Still some discussion to be had on the failure case in #47.
In the example section there is
which seems to indicate that it's not async. There is also the WebIDL format:
However, there is one place where it is written with
await
But the real reason for bringing this up is to understand better how
appHistory.update
and thenavigate
event are intended to work together:If
update
is sync, then does that meanevent.respondWith()
has no effect and you cannot cancel anupdate
with it? Wouldnavigate
event handlers need to differentiate betweenpush
andupdate
in those cases? Or would it still work and just roll back theupdate
at some future point, possibly firing thenavigate
event again?Also, if
update
andpush
are different, does that open the door to potential mixups by developers mis-remembering which needs to beawait
-ed or not? (specifically regarding this section?)Hopefully my questions make sense, and also I hope I didn't miss a section in the docs that explain this. 😃 Thanks!
(edit: This probably ties somewhat into the conversation happening in #19 as well)
The text was updated successfully, but these errors were encountered: