-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
TypeError: navigator.block using the warnWhenUnsavedChanges prop in Form #8163
Comments
FYI we do use warnWhenUnsavedChanges in our examples, and especially in the simple example which is the one we encourage you to fork on codesandbox to provide a reproduction case. If you try it at https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple you will see that it works fine. (see PostEdit or CommentEdit for instance) In your case it might be that you are using a custom router or the wrong version of react-router (you need to use v6). If you are convinced that there is something wrong on the react-admin side, then please fork this sandbox and provide a reproduction case. |
Metoo getting this error after the upgrade from package.json Please prioritize this with the fix. Temp Fix I have removed that props |
@neps-in please provide a reproduction if you want us to take a look at it. |
It seems react-router 6.4.0 broke this, see remix-run/react-router#9262 |
Quick fix in userland: set a resolution in your package.json to force react-router < 6.4.0:
|
Apparently, We have no other choice but to test if the feature exists, and if not, throw an error inviting the developer either to downgrade react-router, or to remove the |
Note that this bug only appears if you use a custom Router. |
After upgrading to version 4 I have an issue with using the warnWhenUnsavedChanges prop in Form.
What you were expecting:
Able to use the warnWhenUnsavedChanges prop in the form component and get an alert when leaving a page that a has a form with data so no data is lost but instead saved before leaving the page.
What happened instead:
When trying to edit a record I get the Error "navigator.block is not a function".
Steps to reproduce:
1- User the Form Component and add the warnWhenUnsavedChanges.
2- Add TextInput fields.
3- Add info in the fields.
4- Get the error.
Environment
Mac
The text was updated successfully, but these errors were encountered: