Skip to content

Commit

Permalink
fix: 为setLastMessageMap增加数组类型校验
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Dec 25, 2022
1 parent 5624b92 commit f622d6a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions client/shared/redux/slices/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,11 @@ const chatSlice = createSlice({
) {
const list = action.payload;

list.forEach((item) => {
state.lastMessageMap[item.converseId] = item.lastMessageId;
});
if (Array.isArray(list)) {
list.forEach((item) => {
state.lastMessageMap[item.converseId] = item.lastMessageId;
});
}
},

/**
Expand Down

0 comments on commit f622d6a

Please sign in to comment.