-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
extraErrors not working properly #3757
Comments
@Sourcekot You found a small bug with |
Fix rjsf-team#3757 by adding a new `extraErrorsBlockSubmit` prop on `Form` - Updated the `FormProps` and `Form` for the new `extraErrorsBlockSubmit` flag - Updated the validation code to detect when the flag is set and there are `extraErrors` and allow the extra error to be focused on - Updated `form-props` documentation with additional details about `extraErrors` as well as the new prop - Updated the `CHANGELOG.md` file accordingly switching from a patch to minor release due to the new feature
Fix #3757 by adding a new `extraErrorsBlockSubmit` prop on `Form` - Updated the `FormProps` and `Form` for the new `extraErrorsBlockSubmit` flag - Updated the validation code to detect when the flag is set and there are `extraErrors` and allow the extra error to be focused on - Updated `form-props` documentation with additional details about `extraErrors` as well as the new prop - Updated the `CHANGELOG.md` file accordingly switching from a patch to minor release due to the new feature
Sadly my problems were only partially fixed and some new problems now occur: Codesandbox: https://codesandbox.io/s/solitary-breeze-7ykd2f
One more thing: Why is the ErrorListTemplate reached every time I change something in the form? LiveValidate is not enabled so I thought this shouldn't happen. |
@Sourcekot Can you open a new issue for these? Thanks! |
Of couse, here you go: #3827 |
Prerequisites
What theme are you using?
mui
Version
5.8.2
Current Behavior
extraErrors not available in transformErrors and focusOnFirstError
extraErrors in arrays not triggering ErrorListTemplate
The ErrorListTemplate is not called again on a submit if the errors didn't change
Expected Behavior
extraErrors should be included in the errors of transformErrors and focusOnFirstError
extraErrors in arrays should trigger ErrorListTemplate
The ErrorListTemplate should be called again on a submit even if the errors didn't change (but I would understand if that behaviour is not wanted)
Steps To Reproduce
https://codesandbox.io/s/bold-wescoff-stm77h
In the codesandbox I'm adding an extraError when the submit button is pressed. You will see that its message is correctly displayed below the field. But there are the following problems with it:
You can see that both transformErrors and focusOnFirstError are reached and contain an error if you clear the field and press submit. The default required check is done and it's message will be transformed to "Error transformed". In the console you can see that focusOnFirstError was also reached as it logged the error object.
But even the behaviour from the codesandbox wouldn't be much better in my project. It might be the wanted behaviour to not call it again if nothing changed but in my case that would be a problem. I'm using a snackbar in the ErrorListTemplate which is only displayed for a few seconds. It will not be displayed again if there where no changes to the errors.
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: