Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/app-council/src/useCounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useApi, trackStream } from '@polkadot/react-hooks';

export default function useCounter (): number {
const { api, isApiReady } = useApi();
const motions = trackStream<Hash[]>(isApiReady ? api.query.council.proposals : undefined, []);
const motions = trackStream<Hash[]>(isApiReady ? api.query.council?.proposals : undefined, []);
const [counter, setCounter] = useState(0);

useEffect((): void => {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-tech-comm/src/useCounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useApi, trackStream } from '@polkadot/react-hooks';

export default function useCounter (): number {
const { api, isApiReady } = useApi();
const proposals = trackStream<Hash[]>(isApiReady ? api.query.technicalCommittee.proposals : undefined, []);
const proposals = trackStream<Hash[]>(isApiReady ? api.query.technicalCommittee && api.query.technicalCommittee.proposals : undefined, []);
Copy link
Copy Markdown
Member

@jacogr jacogr Dec 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const proposals = trackStream<Hash[]>(isApiReady ? api.query.technicalCommittee && api.query.technicalCommittee.proposals : undefined, []);
const proposals = trackStream<Hash[]>(isApiReady ? api.query.technicalCommittee?.proposals : undefined, []);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the suggested change here should be the following:

api.query.technicalCommittee?.proposals

Instead of:

api.query.technicalCommittee?.technicalCommittee.proposals

Otherwise I still get error Uncaught TypeError: Cannot read property proposals of undefined

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little edit boxes :)

const [counter, setCounter] = useState(0);

useEffect((): void => {
Expand Down