fix: ensure draft changes (#3306)

This commit is contained in:
Bartholomew
2020-02-28 11:40:51 +01:00
committed by GitHub
parent 414218c1ee
commit cf81f587cf
86 changed files with 232 additions and 196 deletions

View File

@ -88,13 +88,14 @@ const entryDraftReducer = (state = Map(), action) => {
});
return state.set('localBackup', newState);
}
case DRAFT_CHANGE_FIELD:
case DRAFT_CHANGE_FIELD: {
return state.withMutations(state => {
state.setIn(['entry', 'data', action.payload.field], action.payload.value);
state.mergeDeepIn(['fieldsMetaData'], fromJS(action.payload.metadata));
state.set('hasChanged', true);
const newData = state.getIn(['entry', 'data']);
state.set('hasChanged', !action.payload.entries.some(e => newData.equals(e.get('data'))));
});
}
case DRAFT_VALIDATION_ERRORS:
if (action.payload.errors.length === 0) {
return state.deleteIn(['fieldsErrors', action.payload.uniquefieldId]);