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

Commit cf017fb

Browse files
committed
Properly update child fields in set-pristine action reducer. Fixes #432
1 parent bea932e commit cf017fb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/reducers/form/set-pristine-action-reducer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@ import actionTypes from '../../action-types';
22
import updateField from '../../utils/update-field';
33
import isPristine from '../../form/is-pristine';
44
import updateParentForms from '../../utils/update-parent-forms';
5+
import updateSubFields from '../../utils/update-sub-fields';
56

67
export default function setPristineActionReducer(state, action, localPath) {
78
if (action.type !== actionTypes.SET_PRISTINE) {
89
return state;
910
}
1011

11-
const newState = updateField(state, localPath, {
12+
const updatedField = updateField(state, localPath, {
1213
pristine: true,
13-
}, {
14+
});
15+
16+
const updatedSubFields = updateSubFields(updatedField, localPath, {
1417
pristine: true,
1518
});
1619

17-
return updateParentForms(newState, localPath, (form) => ({
20+
return updateParentForms(updatedSubFields, localPath, (form) => ({
1821
pristine: isPristine(form),
1922
}));
2023
}

0 commit comments

Comments
 (0)