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

Fast track transition.abort() promise rejection #5589

Closed
kanongil opened this issue Sep 15, 2014 · 8 comments
Closed

Fast track transition.abort() promise rejection #5589

kanongil opened this issue Sep 15, 2014 · 8 comments

Comments

@kanongil
Copy link
Contributor

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.

@kanongil
Copy link
Contributor Author

A resolution to this issue might help #5210.

@wagenet
Copy link
Member

wagenet commented Nov 1, 2014

/cc @stefanpenner

@stefanpenner
Copy link
Member

when the promise is aborted

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.

@kanongil
Copy link
Contributor Author

kanongil commented Nov 2, 2014

@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).

@rwjblue
Copy link
Member

rwjblue commented Jan 5, 2015

@machty - Thoughts?

@kanongil
Copy link
Contributor Author

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.

@rwjblue
Copy link
Member

rwjblue commented Aug 25, 2015

A didAbortTransition hook seems reasonable to me for this.

@kanongil - I'd happily review a PR implementing. The new API will need to be feature flagged.

@Serabe
Copy link
Member

Serabe commented Apr 17, 2016

I am closing this. If any of the participants are interested on pursuing this feature, feel free to reopen.

Thank you!

@Serabe Serabe closed this as completed Apr 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants