mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: messagepad: merge current state and incoming payload (#312)
This commit is contained in:
1 parent
1173407598
commit
723ad4951f
1 file changed
+2
-1
@@ -4,10 +4,11 @@ export default function reducer(state = {}, action) {
|
|||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'DIALOGUES_LOAD_DIALOGUES_FULFILLED': {
|
case 'DIALOGUES_LOAD_DIALOGUES_FULFILLED': {
|
||||||
const { messages } = action.payload;
|
const { messages } = action.payload;
|
||||||
return _.keyBy(messages, 'udoc._id');
|
return {...state, ..._.keyBy(messages, 'udoc._id')};
|
||||||
}
|
}
|
||||||
case 'DIALOGUES_CREATE': {
|
case 'DIALOGUES_CREATE': {
|
||||||
const { user } = action.payload;
|
const { user } = action.payload;
|
||||||
|
if (state[user._id]) return state
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
[user._id]: {
|
[user._id]: {
|
||||||
|
|||||||
Reference in new issue
Block a user