Fix Tech comm proposal display (Option) (#1995)
* Fix Tech comm proposal display (Option) * Linting
This commit is contained in:
parent
e1d59233e0
commit
aeb0ea3f0d
@ -12,7 +12,7 @@ import { Call } from '@polkadot/react-components';
|
||||
import translate from '../translate';
|
||||
|
||||
interface Props extends I18nProps {
|
||||
proposal?: Proposal;
|
||||
proposal?: Proposal | null;
|
||||
proposalHash: Hash | string;
|
||||
}
|
||||
|
||||
|
||||
@ -6,10 +6,10 @@ import { Proposal as ProposalType, Votes } from '@polkadot/types/interfaces';
|
||||
import { I18nProps } from '@polkadot/react-components/types';
|
||||
|
||||
import React from 'react';
|
||||
import { useApi, trackStream } from '@polkadot/react-hooks';
|
||||
import { Option } from '@polkadot/types';
|
||||
import { AddressMini } from '@polkadot/react-components';
|
||||
import { useApi, trackStream } from '@polkadot/react-hooks';
|
||||
import ProposalCell from '@polkadot/app-democracy/Overview/ProposalCell';
|
||||
import { Option } from '@polkadot/types';
|
||||
import { formatNumber } from '@polkadot/util';
|
||||
|
||||
import translate from '../translate';
|
||||
@ -21,13 +21,14 @@ interface Props extends I18nProps {
|
||||
|
||||
function Proposal ({ className, hash, t }: Props): React.ReactElement<Props> | null {
|
||||
const { api } = useApi();
|
||||
const proposal = trackStream<ProposalType>(api.query.technicalCommittee.proposalOf, [hash]);
|
||||
const _proposal = trackStream<Option<ProposalType>>(api.query.technicalCommittee.proposalOf, [hash]);
|
||||
const votes = trackStream<Option<Votes>>(api.query.technicalCommittee.voting, [hash]);
|
||||
|
||||
if (!proposal || !votes?.isSome) {
|
||||
if (!votes?.isSome) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const proposal = _proposal?.unwrapOr(null);
|
||||
const { ayes, index, nays, threshold } = votes.unwrap();
|
||||
|
||||
return (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user