Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Fix react-form-state List component #531

Merged
merged 1 commit into from
Feb 27, 2019
Merged

Conversation

marina101
Copy link
Contributor

Fixes: #519

This is a fix for a regression that was introduced in this commit: https://github.com/Shopify/quilt/pull/475/files#diff-68157ac38fbcaa003b546774b1857293R48 on line 48. The bug is that initialValue[index][fieldPath] throws an exception instead of returning undefined the way it previously did when initialValue[index] is undefined. I added an extra check to see if initialValue.index is defined and return undefined if its not.

🎩 it with our form (which has a polymorphic list and uses the List from react-form-state) and now it working instead of throwing an error (relates to #11012).

@marina101 marina101 force-pushed the fix-form-state-list branch 2 times, most recently from c0e6746 to 11a2706 Compare February 26, 2019 16:26
Introduced in this commit: https://github.com/Shopify/quilt/pull/475/files#diff-68157ac38fbcaa003b546774b1857293R48 on line 48. The bug is that initialValue[index][fieldPath] throws an exception instead of returning undefined the way it previously did when initialValue[index] is undefined. I added an extra check to see if initialValue.index is defined and return undefined if its not.
Copy link
Contributor

@TzviPM TzviPM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @marina101; thanks so much for pushing these changes through :)

@marina101 marina101 merged commit 769b09a into master Feb 27, 2019
@TzviPM TzviPM temporarily deployed to production February 27, 2019 15:28 Inactive
@marina101 marina101 deleted the fix-form-state-list branch February 27, 2019 20:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FormState.List is broken when initialValue is empty array
3 participants