Skip to content

Add ability to get field values #95

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

Closed
doytch opened this issue Jul 10, 2019 · 5 comments · Fixed by #96
Closed

Add ability to get field values #95

doytch opened this issue Jul 10, 2019 · 5 comments · Fixed by #96

Comments

@doytch
Copy link

doytch commented Jul 10, 2019

Are you submitting a bug report or a feature request?

Feature Request

What is the current behavior?

FieldArray components get a fields prop which is an object containing various methods.

What is the expected behavior?

It'd be great if it were possible to get the values of those, similar to redux-form's fields.getAll() functionality.

I realise that many problems can be solved by rendering the FieldArray's members as a Field and managing the value there. However, this pattern can be pretty ugly in some situations.

For example, here's an HOC that uses getAll() in production. The point of that HOC is mainly to abstract away the complexity in how our backends handle array member deletion from form fields. The complexity is that when we want to delete an array member object, we need to send back an array that contains an object with the member's id and a _delete key set to true.

The reason the backend operates that way is to basically support PATCH-like requests where an entire array doesn't need to be PUT, just the array members that have changed.

Other information

Similar issue: #13

@to-sh-1
Copy link

to-sh-1 commented Jul 11, 2019

+1 would love this as well

@erikras
Copy link
Member

erikras commented Jul 11, 2019

Ha! This is already there (it's used in tests), but is totally undocumented and untyped.

I'll remedy that shortly.

@erikras
Copy link
Member

erikras commented Aug 15, 2019

Published fix in v3.1.1.

@nvaken
Copy link

nvaken commented Sep 18, 2019

@erikras Is it possible when using subscription={{}} value will be undefined? Is that as designed?

@vufrontend
Copy link

@nvaken I think it is impossible. We have to subscription value to call fields.value. It's weird

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

Successfully merging a pull request may close this issue.

5 participants