If possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
Modify the logic within the FileButton component to safely reset the input value only when inputRef is not null. The following code modification has been tested locally and resolves the issue:
if (inputRef?.current) {
inputRef.current.value = "";
}
It looks like a simple and safe snippet of code.
### Self-service
- [X] I would be willing to implement a fix for this issue
Dependencies check up
What version of @mantine/* packages do you have in package.json?
7.13.2
What package has an issue?
@mantine/core
What framework do you use?
Next.js
In which browsers you can reproduce the issue?
Chrome
Describe the bug
When using the following logic in tsx:
The following error is thrown when resetting the input, and
handleReset
have no way to skip it:https://github.com/mantinedev/mantine/blob/fbcee929e0b11782092f48c1e7af2a1d1c878823/packages/%40mantine/core/src/components/FileButton/FileButton.tsx#L76
If possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
Modify the logic within the
FileButton
component to safely reset the input value only wheninputRef
is not null. The following code modification has been tested locally and resolves the issue:It looks like a simple and safe snippet of code.