peterportal-client
peterportal-client copied to clipboard
Optimize upvote/downvote colors
Currently for the Review component, it does one request on first render to fetch the upvote colors for each review (whether or not they upvoted or downvoted) and then updates the colors for each review.
Additionally, when a user clicks an upvote or downvote, it sends the upvote/downvote request to the backend then it does the fetch again on the colors for each review. This is inefficient and results in a slight delay between the user clicking the upvote/downvote arrow and the color updating. We should fetch the colors for all reviews only that one time on first render. Any upvotes/downvotes the user makes should cause the colors to be updated by changing the color state for that individual review rather than updating them all.