Skip to content

Commit

Permalink
Update reducer.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
MeyerPV committed Nov 20, 2024
1 parent 2fa3c91 commit efc5627
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/store/states/common/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ export const reducer = createReducer<CommonState, Action>(initialState)
if (!nextState.feedItems[commonId]) {
nextState.feedItems[commonId] = { ...initialFeedItems };
}

if (!nextState.pinnedFeedItems[commonId]) {
nextState.pinnedFeedItems[commonId] = { ...initialPinnedFeedItems };
}
Expand Down Expand Up @@ -782,6 +783,10 @@ export const reducer = createReducer<CommonState, Action>(initialState)

// Remove sharedFeedItemId from feedItems and pinnedFeedItems
if (sharedFeedItemId) {
if (!nextState.feedItems[commonId].data) {
nextState.feedItems[commonId].data = initialFeedItems.data; // Ensure it exists
}

nextState.feedItems[commonId].data =
nextState.feedItems?.[commonId]?.data &&
nextState.feedItems[commonId]?.data?.filter(
Expand Down

0 comments on commit efc5627

Please sign in to comment.