From 20e140edf859bb7db0fa75d958c22fe9cb189964 Mon Sep 17 00:00:00 2001 From: MarkNerdi <105642810+MarkNerdi@users.noreply.github.com> Date: Wed, 1 Feb 2023 18:00:05 +0100 Subject: [PATCH] fix: fix details view if account with proposal gets deleted (#5739) Co-authored-by: Tuditi <45079109+Tuditi@users.noreply.github.com> --- .../utils/isAnyAccountVotingForSelectedProposal.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/shared/lib/contexts/governance/utils/isAnyAccountVotingForSelectedProposal.ts b/packages/shared/lib/contexts/governance/utils/isAnyAccountVotingForSelectedProposal.ts index 442d3d24097..858d179a478 100644 --- a/packages/shared/lib/contexts/governance/utils/isAnyAccountVotingForSelectedProposal.ts +++ b/packages/shared/lib/contexts/governance/utils/isAnyAccountVotingForSelectedProposal.ts @@ -1,11 +1,9 @@ -import { activeProfile } from '@core/profile' +import { activeAccounts } from '@core/profile' import { get } from 'svelte/store' import { isVotingForSelectedProposal } from './isVotingForSelectedProposal' export async function isAnyAccountVotingForSelectedProposal(): Promise { - const accountIndexes = Object.values(get(activeProfile)?.accountMetadata).map( - (accountMetadata) => accountMetadata.index - ) + const accountIndexes = get(activeAccounts).map((account) => account.index) const isVotingPromises = accountIndexes.map(isVotingForSelectedProposal) const results = await Promise.all(isVotingPromises) return results.some((bool) => bool === true)