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

Refactored Poll and ViewPollPostPage code #200

Conversation

Sebastian-Webster
Copy link
Member

This fixes the errors with the ViewPollPostPage like TypeError: undefined is not an object evaluating pollData.pollUpOrDownVoted, simplifies the code by moving the Poll post (with votes) out of the ViewPollPostPage and into it's own file (which also means post-related state can be removed from the ViewPollPostPage) and the Poll now uses the usePostReducer hook.

The PollWithVotes component was rewritten to be a class component with a custom shouldComponentUpdate to prevent re-rendering when it is unnecessary.

This also adds compatibility for the new poll-related API implementations as they are moving to having Poll votes stored in a seperate collection instead of being embedded into the Poll document. Related backend pull request: SquareTable/SocialSquare-Backend#143

@Sebastian-Webster Sebastian-Webster added enhancement New feature or request efficiency Cleans code up or makes SocialSquare run faster labels Sep 20, 2023
@Sebastian-Webster Sebastian-Webster added this to the Before Release milestone Sep 20, 2023
@Sebastian-Webster Sebastian-Webster self-assigned this Sep 20, 2023
@Sebastian-Webster Sebastian-Webster merged commit e0bffc4 into main Sep 21, 2023
3 checks passed
@Sebastian-Webster Sebastian-Webster deleted the 165-viewpollpostpage-error-typeerror-undefined-is-not-an-object-evaluating-polldatapollupordownvoted branch September 21, 2023 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
efficiency Cleans code up or makes SocialSquare run faster enhancement New feature or request
Projects
None yet
1 participant