Open Verbon opened 5 years ago
Agree with this - I see no reason you would not want to update on changes in values, errors, touched... etc. for this field.
Isn't this super confusing though? Is this actually more intuitive?
@jaredpalmer I don't think this is confusing. I cannot think (at least for now) of any possible use-case, where I would want my FastField
to not update when its value/error/touched changes. I think updates in these properties are very important, and skipping updates because of custom shouldUpdate
implementation returning false
(which may not take these props into account) may lead to bugs and undesired behavior.
If you are very concerned that this would be a breaking and will break a lot of existing code, I may suggest to add a boolean prop shouldUpdateFallbackToDefault
(not a very good name, just first thing came to mind), which will configure if default shouldUpdate
implementation should or should not be called when custom one returns false
.
Okay makes sense
I'm cool with a PR
@jaredpalmer Here's a PR for fixing that behavior - https://github.com/jaredpalmer/formik/pull/1317
Hey guys, I just bumped into this issue, we fixed it by basically copy/pasting shouldComponentUpdate
into our shouldUpdate
function. Is there any updates on this?
yes @jaredpalmer somehow this fix got lost when the FastField code was copy&pasted in this commit https://github.com/formium/formik/commit/c93a6d4ad059bb8684f48c2d54524f417add2030. Here is a PR which puts back the fix: https://github.com/formium/formik/pull/2761
🚀 Feature request
Current Behavior
Default
FastField
'sshouldComponentUpdate
implementation is not triggered, if customshouldUpdate
implementation returnsfalse
.Desired Behavior
If
FastField
's customshouldUpdate
implementation returnsfalse
, thenFastField
'sshouldComponentUpdate
default implementation should be triggered.Suggested Solution
formik/src/FastField.tsx
Current
FastField
'sshouldComponentUpdate
implementation:should be changed to:
Who does this impact? Who is this for?
All the people!
Describe alternatives you've considered
I thought I could achieve my goals by using
ref
onFastField
and manually triggeringforceUpdate
when I need to, butFastField
is a functional component, soref
's are not allowed.