Comments (5)
Just to confirm, the error vanished after rolling back final-form only, to 4.20.7.
This would further support the theory that the cause probably is 33e551f.
Would still like to get to the bottom of this, as staying with 4.20.7 forever is not our preferred way to go :/
from final-form.
33e551f solved a big bug in arrays so I would like to build on those changes instead of rolling back.
Is it possible to provide a CodeSandbox of some sort of mock-up that we can debug more effectively?
I think we may have some success by just conditionally executing those methods.
from final-form.
Excuse the delay - I wanted to provide a CodeSandbox (failed try: https://codesandbox.io/s/nifty-morning-fwf5sb?file=/src/App.tsx) to not just prevent the error but allow for the best behavior possible. Also asked fellow devs with code insight for creative ideas without success. I have no idea how our end users achieve this :/
Absolutely agree with keeping and improving the fix - we only had to roll back on our side.
I think I have to give up regarding the reproduction :/
Conditionally executing the functions should at least prevent the error. I'm just not sure what the behavior will then be.
Also, I'm wondering where that condition should be placed, as the calls might be anywhere from my understanding. I think it should be wrapped close to the field, so the outside can blindly call blur/change/focus without regard.
If I can assist in that regard, please let me know. Am willing to provide a PR as well, just don't know the project internals too well so far.
from final-form.
I attempted to trigger the error with your Sandbox. Here is a forked version: https://codesandbox.io/s/nervous-grass-dsy7k0?file=/src/App.tsx
I thought it may happen when you call focus or change on a field that is not currently rendered, but that does not seem to be the case...
Other possible causes that I can think of:
- The source error is located in either final-form-arrays, react-final-form-arrays, or calculate.
- New behaviour of arrays - empty arrays return to undefined to match the normal fields, the previous behaviour can be achieved with an identity function passed to the parse callback. But that seems to be fine from my tests....
from final-form.
minor update for anyone wondering:
Gert and me had a quick hangout to demo my use case, it's difficult to transfer to a sandbox. To make the most of it, I prepared a re-release with the versions affected - and didn't get the error anymore. 🤯
One change since then was that we replaced a very busy section of our form that indeed was array-based. Our replacement is more distant from final-form and just interacts via form.changes. So far, we can only suppose that it was the culprit and don't know exactly how we worked around it.
Will still try to reproduce/provoke the issue with some final-form-arrays-insights Gert provided me with - but this might as well be it for this issue :/
from final-form.
Related Issues (20)
- initialValue overrides state on update HOT 1
- How to unregisterField, or at least update the registration? HOT 2
- [Feature Request] Get last dirty state of unregistered field (when `destroyOnUnregister` is false) HOT 2
- Migrate to TypeScript
- keepDirtyOnReinitialize can't handle undefined value HOT 2
- Confusing documentation/messaging
- final-form ^4.20.3 introduced a breaking change for array field names (e.g. choices[]), which worked in v4.20.2 HOT 1
- Field subscription `modifiedSinceLastSubmit`, is defined as `false`, rather than `boolean`. HOT 2
- Issue on TypeScript FieldSubscription
- form state becomes dirty when initial value is empty, and user interacting without actually changing the value HOT 1
- Reacting to onSubmit Promise rejection HOT 1
- Feature: Reuse field states from already created instance HOT 5
- FormSpy components are rendering sooner than previously expected
- FieldArray record level async validation not working HOT 1
- Error with validation when registering array field and array item fields together HOT 1
- Usage of keyof in TypeScript types does not align with field names
- [RFC] TypeScript rewrite of a few Final Form packages HOT 1
- Form not dirty after removing items from FieldArray using final-form-arrays
- Can't register field named 'constructor' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from final-form.