Fix TracksInfo values being undefined and causing a whitescreen (#11320)
* Fix TracksInfo values being undefined and causing a whitescreen * lint
This commit is contained in:
parent
7d872912b2
commit
894c2f90dd
@ -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
|
||||
}));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user