Use `form.getState()` directly instead of using subscriptions.
Hi :),
I was running into timing issues on async error handling (with final-form 4.18.6 and react-final-form 6.3.3). (The promise in onSubmit would resolve before / at the same time the subscription callback fires and would compare against a stale state. I'm not sure why the subscription is needed because we have access to the form state directly with getState().
This pull request adresses the issue of a potential stale state.
Codecov Report
Merging #16 into master will not change coverage. The diff coverage is
100%.
@@ Coverage Diff @@
## master #16 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 5 5
Lines 44 40 -4
Branches 11 11
=====================================
- Hits 44 40 -4
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/decorator.js | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update c26b46e...56dee29. Read the comment docs.
Any more information required to have this merged? :)
I like how this simplifies things. Any reason we shouldn't merge this, @erikras?
@erikras Could you please give some feedback on this issue. We're having the same problem in our projects and have to use fork of this library with similar patch applied.