-
Notifications
You must be signed in to change notification settings - Fork 229
Open
Description
Comment count doesn't update in Scream component, only updates in ScreamDialog if you don't refresh the page. This is because in our state we only update commentCount in scream (accessed by ScreamDialog and not also screams (accessed by Scream).
This can be fixed in dataReducer.js by replacing the code for case SUBMIT_COMMENT: with the following:
case SUBMIT_COMMENT:
let commentedOnIndex = state.screams.findIndex(
scream => scream.screamId === action.payload.screamId
);
return {
...state,
scream: {
...state.scream,
comments: [action.payload, ...state.scream.comments],
commentCount: state.scream.commentCount + 1
},
screams: state.screams.map((scream, screamsArrIndex) =>
screamsArrIndex === commentedOnIndex
? { ...scream, commentCount: scream.commentCount + 1 }
: scream
)
};
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels