-
Notifications
You must be signed in to change notification settings - Fork 26
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
#220 Upgrade mantine packages #223
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@nevendyulgerov , the PR need a rebase. It may need to address other parts for the |
4a0be0b
to
ff805b1
Compare
55755dc
to
cb66073
Compare
…Value instead of setValues function
|
||
if (transformedValues.formMode === "EDITION" && !initialValRef.current) | ||
const setFieldValue = useCallback((name: string, value: unknown) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to cache this function, otherwise it was breaking the specifications page due to an infinite state update loop.
@@ -307,7 +307,8 @@ const DepositFormSingle: FC<Props> = (props) => { | |||
"erc1155Address", | |||
formattedValue, | |||
); | |||
form.setValues({ amount: "", tokenId: "" }); | |||
form.setFieldValue("amount", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using setValues
here was causing the errors to disappear like so:
Screen.Recording.2024-08-09.at.11.37.11.mov
Switching to setFieldValue
mitigates the issue:
Screen.Recording.2024-08-09.at.13.57.01.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! It is sad that a few regressions were introduced. I believe on version 7.8.x is where most were added. Before, setValues()
would have the same result as Object.assign(target, source)
. Nonetheless, I think the changes are better by addressing only the bits causing troubles rather than changing the validation behaviour on every form.
I upgraded all
mantine
packages to their latest versions in all apps/packages that use them and tested for regressions.In regards to the
@mantine/forms
package, I noticed a runtime error on the/specifications/new
page that was causing the page to break. The issue was coming from theform.setFieldValue
function being passed as a dependency to other hooks. Removing it from the dependency array solved that issue. More on this - here.Another thing I noticed was issues with some forms using
setValues
function. This function was causing the validation to be reset for the form resulting in error messages disappearing unexpectedly. Some unit tests were failing because of this. Switching tosetFieldValue
solved that issue.