Skip to content

Commit

Permalink
Empty string should be converted to undefined #1168
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandraBuzila authored and edgarmueller committed Dec 19, 2018
1 parent 61c7530 commit 73f0cec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/core/src/reducers/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ export const coreReducer = (
};
} else {
const oldData: any = _.get(state.data, action.path);
const newData = action.updater(oldData);
let newData = action.updater(oldData);
if (newData === '') {
newData = undefined;
}

const newState: any = _.set(_.cloneDeep(state.data), action.path, newData);
const errors = sanitizeErrors(state.validator, newState);

Expand Down

0 comments on commit 73f0cec

Please sign in to comment.