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
The solution is to memoise the value like: const initVals = useMemo(() => initialValues, [])
What is the expected behavior?
I think the initialValue should only ever be used on the initial render, and not update and reset the form state to the initialValues, as long as they don't change. Although even then I don't think it's appropriate, because it's what I'm used to with input components from libs like @mui
Solution?
I think changing this behaviour might break a lot of use-cases, but perhaps it's a good idea to deprecate the current behaviour of initialValue, and move that effect to the the value prop.
The text was updated successfully, but these errors were encountered:
Bug
What is the current behavior?
Currenlty the
initialValue
is being used when the component is updated, and resets the form state.The solution is to memoise the value like:
const initVals = useMemo(() => initialValues, [])
What is the expected behavior?
I think the
initialValue
should only ever be used on the initial render, and not update and reset the form state to the initialValues, as long as they don't change. Although even then I don't think it's appropriate, because it's what I'm used to with input components from libs like@mui
Solution?
I think changing this behaviour might break a lot of use-cases, but perhaps it's a good idea to deprecate the current behaviour of
initialValue
, and move that effect to the thevalue
prop.The text was updated successfully, but these errors were encountered: