-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Catch cancelled navigations #2012
Comments
@posva When we can expect this? Im just asking :) |
It depends on how much time I can allocate to open source but this one needs more thinking because redirecting can happen in different situations and not all are considered the same (in navigation guard vs in route record). As I'm working on the next version of Vue Router I may find other suitable APIs. |
Thank you very much for response :) |
There is an RFC that solves this vuejs/rfcs#150 |
One related question, is it possible to force a router.push? As in force it not to be cancelled? I have some edge case where the user submits a form and this triggers a redirect I need to force this redirect to not be cancelled, because it can happen that while the redirect occurs, an other router.push is triggered at the exact same time in a completely unrelated code: I have a section observer pushing the current hash/id of the section to the router. So basically if you scroll while submitting you may not get redirected.. I'm thinking something like
@posva It seems the |
@Tofandel A pendingLocation could indeed be exposed, it's worthy of an RFC to discuss if it should unset once a navigation is done, different solutions and problems that may arise. It can be implemented in user land with a combination of |
@posva It actually cannot be implemented in user land easily, since Such a 'loading' state would also not include Currently the simplest way is to create a |
What problem does this feature solve?
This will allow users to hook on:
onRedirect
, also triggered byredirect
option)next(false)
callsI'm a bit sceptical about use cases on why to hook on redirects, so I'll love to read if you have usecases
What does the proposed API look like?
can be triggered by
The text was updated successfully, but these errors were encountered: