Don't query proposal via multi (#1683)
This commit is contained in:
@@ -14,7 +14,10 @@ import { memo } from '../util';
|
||||
|
||||
function retrieveProposals (api: ApiInterfaceRx, section: 'council' | 'technicalCommittee', hashes: Hash[]): Observable<DerivedCollectiveProposals> {
|
||||
return combineLatest([
|
||||
api.query[section].proposalOf.multi<Option<Proposal>>(hashes),
|
||||
// We are doing single subscriptions on all these, multi may yield old results
|
||||
combineLatest(
|
||||
hashes.map((hash): Observable<Option<Proposal>> => api.query[section].proposalOf(hash))
|
||||
),
|
||||
api.query[section].voting.multi<Option<Votes>>(hashes)
|
||||
]).pipe(
|
||||
map(([proposals, votes]: [Option<Proposal>[], Option<Votes>[]]): DerivedCollectiveProposals => {
|
||||
|
||||
@@ -62,7 +62,10 @@ function retrieveProposals (api: ApiInterfaceRx, proposalCount: ProposalIndex, a
|
||||
const allIds = [...proposalIds, ...approvalIds];
|
||||
|
||||
return combineLatest([
|
||||
api.query.treasury.proposals.multi<Option<TreasuryProposal>>(allIds),
|
||||
// We are doing single subscriptions on all these, multi may yield old results
|
||||
combineLatest(
|
||||
allIds.map((id): Observable<Option<TreasuryProposal>> => api.query.treasury.proposals(id))
|
||||
),
|
||||
api.derive.council.proposals()
|
||||
]).pipe(
|
||||
map(([allProposals, councilProposals]: [Option<TreasuryProposal>[], DerivedCollectiveProposals]): DerivedTreasuryProposals =>
|
||||
|
||||
Reference in New Issue
Block a user