mantine icon indicating copy to clipboard operation
mantine copied to clipboard

Form is not marked as dirty if FileInput file is changed

Open zdila opened this issue 3 months ago • 2 comments

Dependencies check up

  • [x] I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

8.3.9

What package has an issue?

@mantine/form

What framework do you use?

Vite

In which browsers you can reproduce the issue?

None

Describe the bug

I use useForm() and

 <FileInput
          key={form.key("image")}
          {...form.getInputProps("image")}

On edit I initialize form with data from server:

    form.setValues(values);

    form.resetDirty(values);

values has image which is a Blob.

If I pick a different image the form is not marked as dirty (form.isDirty() is false).

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

zdila avatar Nov 25 '25 17:11 zdila

Note that calling form.setFieldValue("image", null) will mark form as dirty but after I pick any file it is non-dirty again.

zdila avatar Nov 25 '25 17:11 zdila

Thanks for submitting the issue! In order to proceed, we need a codesandbox with a minimal reproduction. You can use this template to create it – https://codesandbox.io/s/mantine-react-template-q4dd5d?file=/src/App.js.

To learn what is a minimal, reproducible example, please see the article – https://stackoverflow.com/help/minimal-reproducible-example. In short: Minimal reproducible example (MRE) includes only the essential code and data needed to reproduce the problem, excluding unrelated details or complexities. An effective MRE ensures that others can quickly replicate the issue in their own environment without requiring additional context or assumptions.

Please note that issues without reproduction are closed as incomplete if the reproduction is not provided until the next round of issues review (usually 5-10 days after this comment has been posted).

rtivital avatar Dec 09 '25 06:12 rtivital