From a7fb96375e223fef68c97f2728fb167f9958185b Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Mon, 2 Sep 2019 23:10:15 +0200 Subject: [PATCH] Voting: don't query vote status when there's no connected account --- apps/voting/app/src/script.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/voting/app/src/script.js b/apps/voting/app/src/script.js index 8ed3e673b8..f5686304a2 100644 --- a/apps/voting/app/src/script.js +++ b/apps/voting/app/src/script.js @@ -1,6 +1,7 @@ import Aragon, { events } from '@aragon/api' import { addressesEqual } from './web3-utils' import voteSettings from './vote-settings' +import { VOTE_ABSENT } from './vote-types' import { voteTypeFromContractEnum } from './vote-utils' import { EMPTY_CALLSCRIPT } from './evmscript-utils' import tokenDecimalsAbi from './abi/token-decimals.json' @@ -227,6 +228,13 @@ async function getAccountVotes({ connectedAccount, votes = [] }) { } async function getVoterState({ connectedAccount, voteId }) { + if (!connectedAccount) { + return { + voteId, + voteType: VOTE_ABSENT, + } + } + // Wrap with retry in case the vote is somehow not present return retryEvery(() => app