Skip to content

Commit

Permalink
Empty string should be converted to undefined eclipsesource#1168
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandraBuzila committed Dec 19, 2018
1 parent 13efbac commit 6bed38d
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 6bed38d

Please sign in to comment.