-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[v6] [Feature]: usePrompt() should have callback to check 'desired' path before warning #7926
Comments
That's what the |
@timdorr that's the proposed function signature, not the current signature, which is: function usePrompt(message: string, when?: boolean): void |
Sorry, wasn't paying attention... |
Hi. Where are the docs for usePrompt? I cannot find it in the repo or on the dev branch. Thanks Edit: Found it! GitHub search was not finding it https://github.com/remix-run/react-router/blob/dev/packages/react-router-dom/index.tsx#L321 |
@philals I've only been using this blog post as a reference: |
Closing since this API is no longer in the library. #8139 will track when it's added back. |
usePrompt was added back in #9932, any chance this can be reopened? |
What is the new or updated feature that you are suggesting?
Currently usePrompt gives no way to not show the prompt if the user is simply navigating to another path in the same area where a warning wouldnt necessarily be needed or wanted.. for example, if I have 3 tabs on the same page in the same form, navigating between tabs does not clear the state (the user loses no data), but if they navigate out a level ('..') they would lose state.
It would be great to be able to check the 'next' path that the user is trying to go to to decide if they should be prompted.
Why should this feature be included?
This would allow users to change to SOME paths without prompting, but but prompt instead when users are fully leaving an area of your application
The text was updated successfully, but these errors were encountered: