Use asyncScheduler for all derives (#2043)
This commit is contained in:
@@ -9,7 +9,6 @@ import { Active, DidUpdate, Heads, ParaInfoResult, PendingSwap, RelayDispatchQue
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
@@ -92,7 +91,7 @@ export function info (api: ApiInterfaceRx): (id: ParaId | number) => Observable<
|
||||
])
|
||||
.pipe(
|
||||
map((result: Result): DeriveParachainFull | null =>
|
||||
parse(createType(api.registry, 'ParaId', id), result)
|
||||
parse(api.registry.createType('ParaId', id), result)
|
||||
)
|
||||
)
|
||||
: of(null)
|
||||
|
||||
@@ -6,8 +6,8 @@ import { ParaId } from '@polkadot/types/interfaces';
|
||||
import { DeriveParachain, DeriveParachainInfo } from '../types';
|
||||
import { DidUpdate, ParaInfoResult, PendingSwap, RelayDispatchQueueSize } from './types';
|
||||
|
||||
import { Observable, combineLatest, of } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { Observable, asyncScheduler, combineLatest, of } from 'rxjs';
|
||||
import { map, observeOn, switchMap } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
|
||||
import { memo } from '../util';
|
||||
@@ -38,6 +38,7 @@ export function overview (api: ApiInterfaceRx): () => Observable<DeriveParachain
|
||||
return memo((): Observable<DeriveParachain[]> =>
|
||||
api.query.registrar?.parachains && api.query.parachains
|
||||
? api.query.registrar.parachains<ParaId[]>().pipe(
|
||||
observeOn(asyncScheduler),
|
||||
switchMap((paraIds) =>
|
||||
combineLatest([
|
||||
of(paraIds),
|
||||
@@ -47,6 +48,7 @@ export function overview (api: ApiInterfaceRx): () => Observable<DeriveParachain
|
||||
api.query.parachains.relayDispatchQueueSize.multi<RelayDispatchQueueSize>(paraIds)
|
||||
])
|
||||
),
|
||||
observeOn(asyncScheduler),
|
||||
map((result: Result): DeriveParachain[] =>
|
||||
parse(result)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user