Open rogorman9 opened 4 years ago
I have the same issue, modifiedSinceLastSubmit
and dirtySinceLastSubmit
are always false in my FormSpy
.
I use final-form@4.20.2 and react-final-form@6.5.3.
I actually just ran into this. I've confirmed this by also creating a decorator that handles a beforeSubmit
/afterSubmitSucceeded
/afterSubmitFailed
and in the beforeSubmit calling form.getState(). dirtyFieldsSinceLastSubmit
returns the changed values.
I haven't tried this, but a workaround might be to create a decorator that highjacks the original submit function and calls it with the diffed values if that's what you're looking for.
guys it's been 2 years, will there be fix for that?
Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
dirtySinceLastSubmit
is always false anddirtyFieldsSinceLastSubmit
is always an empty Object when accessed viaform.getState()
within theonSubmit
function.What is the expected behavior?
dirtySinceLastSubmit
should be true if the form values are different from the values it was last submitted with. false otherwise. Comparison is done with shallow-equals.dirtyFieldsSinceLastSubmit
should be an object full of booleans, with a value oftrue
for each field that has a different value from the one when the form was last submitted.Sandbox Link
https://codesandbox.io/s/hidden-microservice-lmq65?file=/index.js This is forked from the submission errors example, with the only change being the addition of the
console.log
s and the secondform
argument toonSubmit
.To reproduce, submit the form once with any values. Then change either or both values and submit again. In the console, there will be false and an empty object logged regardless of which values were changed.
What's your environment?
React Final Form version 6.3.4 Final Form version 4.20.1
Other information
Similar to #692, but accessing
dirtyFieldsSinceLastSubmit
in a different way.modifiedSinceLastSubmit
may have the same issue as well.