Skip to content

Commit

Permalink
fix: voting power check while switching accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR committed Dec 25, 2024
1 parent c0e2837 commit ea3866e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion apps/ui/src/stores/votingPowers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type VotingPowerItem = {
error: utils.errors.VotingPowerDetailsError | null;
canPropose: boolean;
canVote: boolean;
account: string;
};

export function getIndex(space: SpaceDetails, block: number | null): string {
Expand Down Expand Up @@ -64,7 +65,8 @@ export const useVotingPowersStore = defineStore('votingPowers', () => {
symbol: space.voting_power_symbol,
error: null,
canPropose: false,
canVote: false
canVote: false,
account
};

if (existingVotingPower) {
Expand Down
5 changes: 4 additions & 1 deletion apps/ui/src/views/Space/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,10 @@ function handleFetchPropositionPower() {
watch(
[() => web3.value.account, () => web3.value.authLoading],
([toAccount, toAuthLoading], [fromAccount]) => {
if (fromAccount && toAccount && fromAccount !== toAccount) {
if (
(fromAccount && toAccount && fromAccount !== toAccount) ||
propositionPower.value?.account !== toAccount
) {
resetPropositionPower();
}
Expand Down

0 comments on commit ea3866e

Please sign in to comment.