Skip to content

Commit

Permalink
Fix Tech comm proposal display (Option) (#1995)
Browse files Browse the repository at this point in the history
* Fix Tech comm proposal display (Option)

* Linting
  • Loading branch information
jacogr committed Dec 3, 2019
1 parent e1d5923 commit aeb0ea3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/app-democracy/src/Overview/ProposalCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
9 changes: 5 additions & 4 deletions packages/app-tech-comm/src/Proposals/Proposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 (
Expand Down

0 comments on commit aeb0ea3

Please sign in to comment.