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
If a hook make the component re-render, then the prevValues will be an empty object and the "updates" function are triggered even if the values did not change
What is the expected behavior?
The "update" function should probably not be triggered, but they are probably because the prevValues is an empty object, which should not happen either
Sandbox Link
My current fix
constdecorator=createDecorator({field: 'foo',updates: (fieldValue,fieldName,allValues,prevValues)=>{if(typeofprevValues[fieldName]==='undefined'){return{};}// do real stuff}})
What is the current behavior?
If a hook make the component re-render, then the prevValues will be an empty object and the "updates" function are triggered even if the values did not change
What is the expected behavior?
The "update" function should probably not be triggered, but they are probably because the prevValues is an empty object, which should not happen either
Sandbox Link
My current fix
Extracted from the final-form-calculate example: https://codesandbox.io/s/react-final-form-calculated-fields-forked-wpm4f?file=/index.js
What's your environment?
The text was updated successfully, but these errors were encountered: