From 15050a39ea9a2d15baaa849a6ed63890797e7237 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Wed, 11 Dec 2024 13:03:00 +0800 Subject: [PATCH] refactor: improve code reading --- apps/ui/src/composables/useVotingPower.ts | 9 +++++---- apps/ui/src/stores/notifications.ts | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/ui/src/composables/useVotingPower.ts b/apps/ui/src/composables/useVotingPower.ts index 846ab0d4c..d2876d84c 100644 --- a/apps/ui/src/composables/useVotingPower.ts +++ b/apps/ui/src/composables/useVotingPower.ts @@ -12,12 +12,13 @@ export function useVotingPower() { } function getProposalSnapshot(proposal: Proposal): number | null { - return ( - (proposal.state === 'pending' && + const snapshot = + proposal.state === 'pending' && !offchainNetworks.includes(proposal.network) ? null - : proposal.snapshot) || getLatestBlock(proposal.network) - ); + : proposal.snapshot; + + return snapshot || getLatestBlock(proposal.network); } function getSnapshot( diff --git a/apps/ui/src/stores/notifications.ts b/apps/ui/src/stores/notifications.ts index 24638e435..20b4b2cdf 100644 --- a/apps/ui/src/stores/notifications.ts +++ b/apps/ui/src/stores/notifications.ts @@ -135,6 +135,7 @@ export const useNotificationsStore = defineStore('notifications', () => { } else if (!followedSpacesIds.length && refreshNotificationInterval) { clearInterval(refreshNotificationInterval); refreshNotificationInterval = 0; + notifications.value = []; } }, { immediate: true }