-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Calling setFieldError in form onSubmit second time undoes error #6125
Labels
Duplicate
A duplicate of other issue
Comments
I get the same error. |
Closed
2 tasks
I'm facing the same problem. |
Can confirm. This is still an issue in the latest release. |
Duplicate of #6101 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dependencies check up
What version of @mantine/* packages do you have in package.json?
7.8.1
What package has an issue?
@mantine/core
What framework do you use?
Next.js
In which browsers you can reproduce the issue?
None
Describe the bug
Thanks for the awesome library!
I noticed some weird behavior when calling
setFieldError
in theonSubmit
handler. Namely, when you submit multiple times without changing the text input, the error disappears.In the linked code sandbox:
I would not expect the error to disappear.
As a workaround, I have disabled the button while there are errors. I did this using
disabled={Object.keys(form.errors).length > 0}
, but please let me know if there's a cleaner way (it might be nice to be able to callform.hasErrors()
or something).If possible, include a link to a codesandbox with a minimal reproduction
https://codesandbox.io/p/sandbox/spring-currying-3zc49y?file=%2Fsrc%2FApp.tsx%3A11%2C36
Possible fix
No response
Self-service
The text was updated successfully, but these errors were encountered: