Skip to content

Commit

Permalink
Fix folding of subscribed/unsubscribed post
Browse files Browse the repository at this point in the history
The NOTIFY_OF_ALL_COMMENTS response should only update the notifyOfAllComments post property
  • Loading branch information
davidmz committed Dec 19, 2023
1 parent 17679cd commit 2d8a3a8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/redux/reducers/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,22 @@ export function posts(state = {}, action) {
};
}
case response(CREATE_POST):
case response(GET_SINGLE_POST):
case response(NOTIFY_OF_ALL_COMMENTS): {
case response(GET_SINGLE_POST): {
return updatePostData(state, action);
}
case response(NOTIFY_OF_ALL_COMMENTS): {
const post = state[action.request.postId];
const payloadPost = action.payload.posts;
return post
? {
...state,
[post.id]: {
...post,
notifyOfAllComments: payloadPost.notifyOfAllComments,
},
}
: state;
}
case REALTIME_POST_NEW: {
return { ...state, [action.post.id]: postParser(action.post) };
}
Expand Down

0 comments on commit 2d8a3a8

Please sign in to comment.