Replies: 1 comment
-
Why can't you just invoke |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The
unstable_usePrompt
hook works well for preventing navigation and providing visual feedback when a form has unsaved changes, for example:However, I would also like to trigger this prompt programmatically—for instance, when a user tries to close a
Dialog
with unsaved changes. Currently, I have to use a workaround like this:This approach relies on
@toolpad/core
for the confirmation dialog. I would prefer a solution that uses only React Router for consistent styling and to reduce third-party dependencies.It would be very helpful if
unstable_usePrompt
could return atrigger
method, allowing the prompt to be invoked programmatically (e.g., when closing a dialog with unsaved changes).Beta Was this translation helpful? Give feedback.
All reactions