-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fast track transition.abort() promise rejection #5589
Comments
A resolution to this issue might help #5210. |
/cc @stefanpenner |
There is no concept of aborting a promise. Luckily this isn't a promise rather a transition and as such it could support this. This is really a router level concern, so I would like pull @machty in to weigh in his thoughts. |
@stefanpenner I appear to have written promise when I meant transition. This is clearly a router level issue, and an implementation should not touch the underlying promise logic. To recap my issue: A transition has an associated promise. When the transition is aborted, I would like this promise to reject immediately (or add a hook that enables client code to detect the abort). |
@machty - Thoughts? |
Any update on this? I think that this is a useful feature, and if need be I am willing to implement it myself. However, I do need some feedback as to which direction is the most viable. |
A @kanongil - I'd happily review a PR implementing. The new API will need to be feature flagged. |
I am closing this. If any of the participants are interested on pursuing this feature, feel free to reopen. Thank you! |
The
abort()
method will tell the transition that it is aborted but if it is busy fetching a model or similar, the promise won't reject until the fetching is complete. This is later than I would expect.This behavior actually works fine most of the time, e.g. when the transition is aborted to start another transition, or is aborted before it begins fetching the model. However, it becomes problematic when you have a visual loading indicator and you want to enable the user to abort slow loading routes by pressing the escape key (standard browser behavior). In this case there is no immediate hook that will notify that the transition has been aborted, and allow me to cancel the indicator.
I see 2 ways to fix this issue. Either follow my suggestion and somehow reject the promise immediately, or add an additional hook like
didAbortTransition
.The text was updated successfully, but these errors were encountered: