Skip to content

Commit

Permalink
Merge pull request #1948 from coveo/ADUI-6831-code-editor-store-value
Browse files Browse the repository at this point in the history
fix(code editor): prevent reducer from crashing on empty state
  • Loading branch information
dmgauthier authored Apr 14, 2021
2 parents 523a046 + aac4e14 commit bc2a4dd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const codeEditorsReducer = (
},
};
case CodeEditorActionTypes.remove:
if (Object.keys(state).length > 1) {
if (state && Object.keys(state).length > 1) {
delete state[action.payload.id];
} else {
state = null;
Expand Down

0 comments on commit bc2a4dd

Please sign in to comment.