-
Notifications
You must be signed in to change notification settings - Fork 23
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
refactor: migrate voting power to vue query #1220
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR refactors the voting power logic by migrating the voting power composable/store code to use vue-query, ensuring that errors from fetching voting power for both proposals and spaces are handled independently. Key changes include:
- Replacing the legacy voting power store/composable with useQuery–based implementations in votingPower.ts.
- Updating the Space/Proposals and Proposal views to use the new vue-query hooks.
- Removing the old voting power store and composable files while updating related components and modals.
Reviewed Changes
File | Description |
---|---|
apps/ui/src/queries/votingPower.ts | Introduces vue-query-based fetching of voting power with new query keys. |
apps/ui/src/views/Space/Proposals.vue | Updates to use the new useSpaceVotingPowerQuery, removing legacy calls. |
apps/ui/src/views/Proposal.vue | Uses the new useProposalVotingPowerQuery, refactoring error and loading states. |
apps/ui/src/stores/votingPowers.ts | Entire file removed as part of the migration. |
apps/ui/src/composables/useVotingPower.ts | Entire file removed as part of the migration. |
apps/ui/src/components/Modal/VotingPower.vue | Adjusted imports and event names to match new voting power query usage. |
apps/ui/src/components/Modal/Vote.vue | Updated to utilize the new proposal voting power query. |
apps/ui/src/components/IndicatorVotingPower.vue | Refactored to use new props and imports from the updated voting power query. |
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR refactors voting power logic by migrating from the previous composable/store implementation to use vue-query. Key changes include:
- Introducing new queries in apps/ui/src/queries/votingPower.ts for retrieving voting power.
- Updating components, views, and helper imports to use the new queries.
- Removing the obsolete voting power store and composable files.
Reviewed Changes
File | Description |
---|---|
apps/ui/src/queries/votingPower.ts | Introduces voting power queries and related helper functions |
apps/ui/src/helpers/utils.ts | Updates import source of VotingPowerItem to the new queries |
apps/ui/src/views/Space/Proposals.vue | Replaces the old voting power composable with the new query hooks |
apps/ui/src/views/Proposal.vue | Replaces voting power fetching and handling with new query hooks |
apps/ui/src/stores/votingPowers.ts | Removes the obsolete voting power store |
apps/ui/src/composables/useVotingPower.ts | Removes the obsolete voting power composable |
apps/ui/src/components/ProposalsListItem.vue | Minor adjustment to conditionally render the vote modal |
apps/ui/src/components/Modal/VotingPower.vue | Updates props and event names to align with the new query implementation |
apps/ui/src/components/Modal/Vote.vue | Updates voting power handling to use the new query, including proper state |
apps/ui/src/components/MessageVotingPower.vue | Updates import source for VotingPowerItem to the new queries |
apps/ui/src/components/IndicatorVotingPower.vue | Updates props, import, and event to use the new voting power query setup |
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Summary
Closes: #939
Toward https://github.com/snapshot-labs/workflow/issues/410
This PR completes the refactoring process on the voting/proposing power composable, by migrating the remaining voting power composable/store to vue-query
This also fix an issue where any errors on either the proposing power or voting power would fail the entire fetching in the single multi-use composable.
How to test