Skip to content

Commit

Permalink
conditionally fetch voting power
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabricevladimir committed Nov 1, 2023
1 parent 81a100c commit c3123d7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/pages/proposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,22 @@ export const Proposal: React.FC = () => {
});
const tokenBalance = BigNumber.from(tokenBalanceData?.value ?? 0);

const shouldFetchPastVotingPower =
address != null &&
daoToken != null &&
proposal != null &&
proposal.status === ProposalStatus.ACTIVE;

const {data: pastVotingPower = constants.Zero} = usePastVotingPower(
{
address: address as string,
tokenAddress: daoToken?.address as string,
blockNumber: proposal?.creationBlockNumber as number,
network,
},
{enabled: address != null && daoToken != null && proposal != null}
{
enabled: shouldFetchPastVotingPower,
}
);

const pluginClient = usePluginClient(pluginType);
Expand Down

0 comments on commit c3123d7

Please sign in to comment.