chore: stash feed pagination

This commit is contained in:
zerosoul
2022-05-27 22:03:08 +08:00
parent 629f7e67a1
commit dbffe6fb4b
9 changed files with 549 additions and 220 deletions
+11
View File
@@ -33,6 +33,16 @@ const channelMsgSlice = createSlice({
}
}
},
replaceChannelMsg(state, action) {
const { id, localMid, serverMid } = action.payload;
if (state[id]) {
const localIdx = state[id].findIndex((i) => i == localMid);
if (localIdx > -1 && serverMid) {
// 存在 则再删除
state[id].splice(localIdx, 1, serverMid);
}
}
},
removeChannelSession(state, action) {
const ids = Array.isArray(action.payload)
? action.payload
@@ -49,5 +59,6 @@ export const {
fullfillChannelMsg,
addChannelMsg,
removeChannelMsg,
replaceChannelMsg,
} = channelMsgSlice.actions;
export default channelMsgSlice.reducer;
+11
View File
@@ -42,6 +42,16 @@ const userMsgSlice = createSlice({
}
}
},
replaceUserMsg(state, action) {
const { id, localMid, serverMid } = action.payload;
if (state.byId[id]) {
const localIdx = state.byId[id].findIndex((i) => i == localMid);
if (localIdx > -1 && serverMid) {
// 存在 则再删除
state.byId[id].splice(localIdx, 1, serverMid);
}
}
},
removeUserSession(state, action) {
const ids = Array.isArray(action.payload)
? action.payload
@@ -59,5 +69,6 @@ export const {
fullfillUserMsg,
addUserMsg,
removeUserMsg,
replaceUserMsg,
} = userMsgSlice.actions;
export default userMsgSlice.reducer;