diff --git a/src/store/states/inbox/reducer.ts b/src/store/states/inbox/reducer.ts index 3794a6f44c..08a1e165d1 100644 --- a/src/store/states/inbox/reducer.ts +++ b/src/store/states/inbox/reducer.ts @@ -453,6 +453,7 @@ export const reducer = createReducer(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(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 }) =>