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

Commit

Permalink
Fix Form-State List regression
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marina101 committed Feb 26, 2019
1 parent 36cf93b commit 11a2706
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/react-form-state/src/components/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export default class List<Fields> extends React.Component<
const innerFields: FieldDescriptors<Fields> = mapObject(
fieldValues,
(value, fieldPath) => {
const initialFieldValue = initialValue[index][fieldPath];
const initialFieldValue =
initialValue[index] && initialValue[index][fieldPath];
return {
value,
onBlur,
Expand Down

0 comments on commit 11a2706

Please sign in to comment.