@mantine/form use-form-status.ts: When determining the dirty state, getting a snapshot value by path throws a TypeError #6672
Labels
Fixed patch
Completed issues that will be published with next patch (1.0.X)
Dependencies check up
What version of @mantine/* packages do you have in package.json?
7.12.1
What package has an issue?
@mantine/form
What framework do you use?
Next.js
In which browsers you can reproduce the issue?
All
Describe the bug
The commit 73827b3 introduced a bug in
packages/@mantine/form/src/hooks/use-form-status/use-form-status.ts
. The following line passes the values snapshot topackages/@mantine/form/src/paths/get-path.ts
:In
get-path.ts
, this line can fail with a TypeError (value
isnull
):This happens when the form values contain a nullable object and then e.g.
form.setFieldValue
is used to set a value for a path that refers to a field nested within the object that was previouslynull
. Setting the value itself works (form.values
is set correctly), but the comparison to the “values snapshot” fails because the path cannot be resolved to a value.If possible, include a link to a codesandbox with a minimal reproduction
https://codesandbox.io/p/sandbox/mantine-react-template-forked-26rn7w
Possible fix
In
get-path.ts
, thisif
statement only checks ifvalue
isundefined
but should probably also check fornull
.Self-service
The text was updated successfully, but these errors were encountered: