Created
June 4, 2021 18:46
-
-
Save michael-mckenna/d04e8706c2d04ceba7cfe38c0d6f12c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case EMessageActions.AddMessage: | |
const channelId = action.payload[0]; | |
const newMsg = action.payload[1]; | |
const entity = state.entities[channelId]; | |
const newMsgArray = [ | |
...entity.messages, | |
newMsg | |
]; | |
// Creates new entity with the new message, or updates an existing entity and appends message | |
return messageAdapter.upsertOne({ | |
...entity, | |
messages: newMsgArray | |
}, state); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment