Skip to content

Commit

Permalink
narrowsReducer/eventUpdateMessageFlags: Assert operation is add | remove
Browse files Browse the repository at this point in the history
Adds an assertion to match the type in EventUpdateMessageFlagsAction
in src/actionTypes.js, so that action.operation can only be 'add' or
'remove'.
  • Loading branch information
Chris Bobbe committed Sep 20, 2019
1 parent 03ce706 commit 3b7078e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/chat/narrowsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ const eventUpdateMessageFlags = (state, action) => {
updates.push({
[narrowStr]: state[narrowStr].filter(id => !messagesSet.has(id)),
});
} else {
throw new Error(`Unexpected operation ${operation} in an EVENT_UPDATE_MESSAGE_FLAGS action`);
}
}

Expand Down

0 comments on commit 3b7078e

Please sign in to comment.