Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve and fix types of value in useFieldArray #174

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

Open
iamdey wants to merge 2 commits into final-form:master
base: master
Choose a base branch
Loading
from iamdey:master

Conversation

Copy link

@iamdey iamdey commented Nov 8, 2022
edited
Loading

I found that value is not always defined, I added tests as proof and improve typing as well.


@erikras, may I take the opportunity to ask if Final Form will be maintained ?
I find the library pretty cool, there some flaws in the design (cf. issues on the react final form repository), and I recently made a long comparison for our form framework migration since redux-form is deprecated. I hope I can publish it soon. Long story short: coming from redux-form, Final Form is light-weight, fast, and easy to learn, it only miss popularity on github.

peruukki reacted with thumbs up emoji
iamdey added 2 commits November 8, 2022 10:12
`value` can be `undefined` if it has not been initialized.
Note: this is already correctly typed for typescript
Copy link

This seems even more relevant now that final-form-arrays v3.1.0 sets the value to undefined:

Change remove and removeBatch behavior to set array value to undefined when all items have been removed.

I was about to create an issue about this but then noticed this pull request. 🙂

larissaleite and raghavsharma-simpplr reacted with thumbs up emoji

Copy link

raghavsharma-simpplr commented Aug 7, 2024
edited
Loading

@iamdey, IMO we should be adding a generic type too. I have a use case,

const {
 fields: { value },
 } = useFieldArray('options[0]');

Where value will now be { label: string; value: string }, shouldn't we have a generic type too?

@erikras should I open a pull request? Without the proper type I have to enforce it manually 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /