-
Notifications
You must be signed in to change notification settings - Fork 959
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
Transition API #14
Comments
We actually support both (1) and (2) with the current API. The
On all of these platforms, we can provide a sane default and the vast majority of users never actually have to know about Advanced users can still display their own custom dialog inside My questions are:
|
Probably not. Lets wait for people to complain. |
Well there are a bunch of good examples where you want custom dialog's. Think about a react application that has a sign up and a chat (e.g. Slack). Now on signup you might wanna warn the user that he looses all his data if he leaves. On the chat you want him to make a decision between do you wanna throw your message away or send it before leaving or cancel leaving at all. For that you need to have the capabilities to show context based custom dialog's. And I am sure there are tons of other use-cases too where you need that. |
After registering a transition hook, there are two cases when transitioning away from a location:
In the case of (1), the only thing we can do is provide a string to
onbeforeunload
to get a confirmation from the user (https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload).In the case of (2) we could allow the developer to do anything they want.
Currently
history
only handles case (1) with a bit of indirection between creating the history and registering hooks.A strawman API to allow for both, and remove the indirection could look something like:
With this API there would be no need for
getUserConfirmation
and we could allow devs more freedom when transitioning inside the app instead of restricting them to the constraints ofonbeforeunload
in all cases.The text was updated successfully, but these errors were encountered: