Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 4e8dcf6

Browse files
committed
add fix for undefined property $form of null which happens in obscure circumstances that I'm still trying to write a concrete test for
1 parent ba84670 commit 4e8dcf6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/reducers/form/reset-action-reducer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import actionTypes from '../../action-types';
22
import updateField from '../../utils/update-field';
33
import mapValues from '../../utils/map-values';
44
import initialFieldState from '../../constants/initial-field-state';
5+
import isPlainObject from 'lodash/isPlainObject';
56
import i from 'icepick';
67

7-
const resetFieldState = (field) => {
8+
const resetFieldState = (field, key) => {
9+
if (!isPlainObject(field) || key === '$form') return field;
10+
811
if (field.$form) return mapValues(field, resetFieldState);
912

1013
return i.merge(initialFieldState, {

0 commit comments

Comments
 (0)