Skip to content

Commit

Permalink
fix: voting power for offchain pending proposals should use the propo…
Browse files Browse the repository at this point in the history
…sal snapshot (#1042)

* fix: voting power for offchain pending proposals should use the proposal snapshot

* refactor: improve code reading
  • Loading branch information
wa0x6e authored Dec 11, 2024
1 parent 4172135 commit ebd0b3b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions apps/ui/src/composables/useVotingPower.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { supportsNullCurrent } from '@/networks';
import { offchainNetworks, supportsNullCurrent } from '@/networks';
import { getIndex } from '@/stores/votingPowers';
import { NetworkID, Proposal, Space } from '@/types';

Expand All @@ -12,10 +12,13 @@ export function useVotingPower() {
}

function getProposalSnapshot(proposal: Proposal): number | null {
return (
(proposal.state === 'pending' ? null : proposal.snapshot) ||
getLatestBlock(proposal.network)
);
const snapshot =
proposal.state === 'pending' &&
!offchainNetworks.includes(proposal.network)
? null
: proposal.snapshot;

return snapshot || getLatestBlock(proposal.network);
}

function getSnapshot(
Expand Down

0 comments on commit ebd0b3b

Please sign in to comment.