Open
Description
Dependencies check up
- I have verified that I use latest version of all @mantine/* packages
What version of @mantine/* packages do you have in package.json?
8.0.1
What package has an issue?
@mantine/form
What framework do you use?
Vite
In which browsers you can reproduce the issue?
Not applicable – issue is not related to the browser
Describe the bug
const initialType = useMemo(
() => getInitialType(value, chips),
[value, chips]
);
const activeField = useField<DurationInputType>({
initialValue: initialType,
});
console.log({isDirty: activeField.isDirty(), activeValue});
Maybe this is not a bug, but a feature, but on the first sight it looks not right. My initialValue
has changed in time, what causes isDirty
returned value to true
, what is unintuitive because value
is not changed programmatically (by setValue
) or by user in an input.
This is fragment from @mantine/forms
code, which is responsible for that:
// @mantine/form/esm/use-field.mjs
const isDirty = useCallback(() => valueRef.current !== initialValue, [initialValue]);
If this is a feature, not a bug, I would like to ask you to help, how I should be done.
If possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
No response
Self-service
- I would be willing to implement a fix for this issue
Metadata
Metadata
Assignees
Labels
No labels