Skip to content

Commit

Permalink
fix feed item duplication in the inbox page
Browse files Browse the repository at this point in the history
budnik9 committed Nov 30, 2023
1 parent 0596f7c commit 72365f7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/store/states/inbox/reducer.ts
Original file line number Diff line number Diff line change
@@ -453,6 +453,7 @@ export const reducer = createReducer<InboxState, Action>(INITIAL_INBOX_STATE)
produce(state, (nextState) => {
const payload = action.payload.filter(
(item) =>
item.item.itemId !== state.sharedItem?.itemId &&
!nextState.chatChannelItems.some(
(chatChannelItem) => chatChannelItem.itemId === item.item.itemId,
),
@@ -558,7 +559,18 @@ export const reducer = createReducer<InboxState, Action>(INITIAL_INBOX_STATE)
)
.handleAction(actions.setSharedInboxItem, (state, { payload }) =>
produce(state, (nextState) => {
nextState.sharedItem = payload && { ...payload };
const sharedItem = payload && { ...payload };

nextState.sharedItem = sharedItem;

if (sharedItem && nextState.items.data) {
nextState.items = {
...nextState.items,
data: nextState.items.data.filter(
(item) => item.itemId !== sharedItem.itemId,
),
};
}
}),
)
.handleAction(actions.addChatChannelItem, (state, { payload }) =>

0 comments on commit 72365f7

Please sign in to comment.