diff --git a/packages/page-referenda/src/useTracks.ts b/packages/page-referenda/src/useTracks.ts index b43d15a588..af50fda784 100644 --- a/packages/page-referenda/src/useTracks.ts +++ b/packages/page-referenda/src/useTracks.ts @@ -8,12 +8,15 @@ import type { PalletReferenda, TrackDescription } from './types.js'; import { useMemo } from 'react'; import { createNamedHook, useApi } from '@polkadot/react-hooks'; +import { BN_ZERO } from '@polkadot/util'; import { calcCurves } from './util.js'; +const zeroGraph = { approval: [BN_ZERO], support: [BN_ZERO], x: [BN_ZERO] }; + function expandTracks (tracks: [BN, PalletReferendaTrackInfo][]): TrackDescription[] { return tracks.map(([id, info]) => ({ - graph: calcCurves(info), + graph: info.decisionDeposit && info.minApproval && info.minSupport ? calcCurves(info) : zeroGraph, id, info }));