Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FieldArray doesn't update children when new value is provided #177

Open
stefvanhouten opened this issue Feb 14, 2021 · 3 comments
Open

FieldArray doesn't update children when new value is provided #177

stefvanhouten opened this issue Feb 14, 2021 · 3 comments

Comments

@stefvanhouten
Copy link

I am trying to use the fieldarray as descirbed in http://jquense.github.io/react-formal/api/FieldArray.
The only difference is that instead of using defaultValue I am using value hooked to the state to create a controlled component.

The issue occurs when the state changes, for example a new object gets pushed into the list, in this chase the arrayField is not updated and still shows the old values.

@jquense
Copy link
Owner

jquense commented Feb 14, 2021

How are you pushing into the list? The array value isn't observed you need to use the array helper methods to do manipulations that RF knows about.

@stefvanhouten
Copy link
Author

I tried using the array helpers but I need a dynamic field that is based on data coming from the server. I tried pushing/removing changed state with the arrayhelpers but when doing so I would get a warning that you cannot update a component while rendering.

@jquense
Copy link
Owner

jquense commented Feb 16, 2021

There isn't much I can do to help without some code, can you reproduce the issue in a codesandbox?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants