You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use <input type="file" /> it doesn't update form state isDirty prop as I would expect. I have some form with default values (which are actually presenting data record) and one of them is a file. Documentation says about isDirty:
File typed input will need to be managed at the app level due to the ability to cancel file selection and FileList object.
Do not support custom object, Class or File object.
However, it works fine if default value is a file and you set the input to be empty. What can I try to handle situations when it is required to know whether user has selected any file? At least how to make it track if anything was changed, doesn't matter if it is the same file as the default one, or not (I guess comparing files may be too complicated). Since it is mentioned in docs that File objects are not supported, why does it still handle that prop, so I can not set it manually, because it is reset all the time by the form... Is touchedFields object something that I should consider to use? Any other ideas or explanations?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When I use
<input type="file" />
it doesn't update form stateisDirty
prop as I would expect. I have some form with default values (which are actually presenting data record) and one of them is a file. Documentation says aboutisDirty
:However, it works fine if default value is a file and you set the input to be empty. What can I try to handle situations when it is required to know whether user has selected any file? At least how to make it track if anything was changed, doesn't matter if it is the same file as the default one, or not (I guess comparing files may be too complicated). Since it is mentioned in docs that File objects are not supported, why does it still handle that prop, so I can not set it manually, because it is reset all the time by the form... Is
touchedFields
object something that I should consider to use? Any other ideas or explanations?Beta Was this translation helpful? Give feedback.
All reactions