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

fix: avoid user votes flashing on load #518

Merged
merged 3 commits into from
Jul 23, 2024
Merged

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Jul 22, 2024

Summary

When re-loading the connected users' votes again for the same space, the votes object will be cleared before the API requeste, then re-populated again with the results.

This creates some flashing on the UI, where the state of an item where the user has already voted will flash briefly to "Not voted" state while the API request is fetching.

This PR will clear the local votes object only for guest user, connected user votes will just overwrite the existing one (removed the object concatenation, as we're just loading and saving in the memory votes from a single space)

@wa0x6e wa0x6e requested a review from Sekhmet July 22, 2024 09:55
@wa0x6e wa0x6e requested a review from Sekhmet July 23, 2024 01:28
Copy link
Member

@Sekhmet Sekhmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide a test plan for the issue this PR is fixing? I'm not sure what exactly should I test against so I'm not sure if my suggestions are not breaking goal of this PR.

apps/ui/src/composables/useAccount.ts Outdated Show resolved Hide resolved
@wa0x6e wa0x6e requested a review from Sekhmet July 23, 2024 09:04
Copy link
Member

@Sekhmet Sekhmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@Sekhmet Sekhmet merged commit f63b0e2 into master Jul 23, 2024
3 checks passed
@Sekhmet Sekhmet deleted the fix-avoid-votes-flashing branch July 23, 2024 09:11
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.

2 participants