Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed reaction count on comments #4243

Merged
merged 2 commits into from
Jun 14, 2023
Merged

Fixed reaction count on comments #4243

merged 2 commits into from
Jun 14, 2023

Conversation

kurtisassad
Copy link
Contributor

Link to Issue

Closes: #4186

Description of Changes

  • change CommentReactionButton so it updates on getCommentsReaction via EventEmitter.

Test Plan

  • Created a thread with multiple comments, like/disliked them, refreshed page.

Other Considerations

I guess this would be a good candidate for using Zustand. I know Marcin is out, so I am not sure if we want to go this route (since it might be better if he could review it to make sure we are all on board with the structure). Anyways if we want to still go ahead and use Zustand, let me know in the comments, and I will convert this PR.

@jnaviask
Copy link
Collaborator

@kurtisassad this is actually an opportunity for react-query rather than zustand, given that the state originates in an API call + is updated via API call mutations. Zustand is best used with state that is carried across many different component hierarchies (avoids massive prop drilling), while react-query works best when there's a single source of truth from the API that gets modified by user interaction.

We can merge this PR as-is, but I will create another ticket for react-query usage.

@kurtisassad kurtisassad force-pushed the ka.reaction-count-fix branch from 9cb1ecd to da95eeb Compare June 14, 2023 15:41
@jnaviask
Copy link
Collaborator

Teed up #4244 to be a separate PR.

@jnaviask jnaviask merged commit f03f10b into master Jun 14, 2023
@jnaviask jnaviask deleted the ka.reaction-count-fix branch June 14, 2023 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comment Reactions: Optimize + Fix race condition
2 participants