Bump @polkadot/util & use nextTick (#4882)
This commit is contained in:
@@ -30,8 +30,8 @@
|
||||
"@polkadot/rpc-core": "8.6.3-3",
|
||||
"@polkadot/types": "8.6.3-3",
|
||||
"@polkadot/types-codec": "8.6.3-3",
|
||||
"@polkadot/util": "^9.3.1",
|
||||
"@polkadot/util-crypto": "^9.3.1",
|
||||
"@polkadot/util": "^9.3.2-1",
|
||||
"@polkadot/util-crypto": "^9.3.2-1",
|
||||
"rxjs": "^7.5.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -9,6 +9,8 @@ import type { DeriveApi } from '../types';
|
||||
|
||||
import { BehaviorSubject, map, of, switchMap, tap, toArray } from 'rxjs';
|
||||
|
||||
import { nextTick } from '@polkadot/util';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
function traverseLinks (api: DeriveApi, head: AccountId32 | string): Observable<PalletBagsListListNode[]> {
|
||||
@@ -19,11 +21,11 @@ function traverseLinks (api: DeriveApi, head: AccountId32 | string): Observable<
|
||||
api.query.bagsList.listNodes(account)
|
||||
),
|
||||
tap((node: Option<PalletBagsListListNode>): void => {
|
||||
setTimeout((): void => {
|
||||
nextTick((): void => {
|
||||
node.isSome && node.value.next.isSome
|
||||
? subject.next(node.unwrap().next.unwrap())
|
||||
: subject.complete();
|
||||
}, 0);
|
||||
});
|
||||
}),
|
||||
toArray(), // toArray since we want to startSubject to be completed
|
||||
map((all: Option<PalletBagsListListNode>[]) =>
|
||||
|
||||
@@ -6,8 +6,8 @@ import type { AnyFunction } from '@polkadot/types/types';
|
||||
import type { ExactDerive } from './derive';
|
||||
import type { DeriveApi } from './types';
|
||||
|
||||
import { lazyDeriveSection } from './util/lazy';
|
||||
import { derive } from './derive';
|
||||
import { lazyDeriveSection } from './util';
|
||||
|
||||
export * from './derive';
|
||||
export * from './type';
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { DeriveApi, DeriveContributions } from '../types';
|
||||
|
||||
import { BehaviorSubject, combineLatest, EMPTY, map, of, startWith, switchMap, tap, toArray } from 'rxjs';
|
||||
|
||||
import { arrayFlatten, isFunction } from '@polkadot/util';
|
||||
import { arrayFlatten, isFunction, nextTick } from '@polkadot/util';
|
||||
|
||||
import { memo } from '../util';
|
||||
import { extractContributed } from './util';
|
||||
@@ -67,11 +67,11 @@ function _getKeysPaged (api: DeriveApi, childKey: string): Observable<StorageKey
|
||||
api.rpc.childstate.getKeysPaged(childKey, '0x', PAGE_SIZE_K, startKey)
|
||||
),
|
||||
tap((keys): void => {
|
||||
setTimeout((): void => {
|
||||
nextTick((): void => {
|
||||
keys.length === PAGE_SIZE_K
|
||||
? subject.next(keys[PAGE_SIZE_K - 1].toHex())
|
||||
: subject.complete();
|
||||
}, 0);
|
||||
});
|
||||
}),
|
||||
toArray(), // toArray since we want to startSubject to be completed
|
||||
map((keyArr: StorageKey[][]) => arrayFlatten(keyArr))
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { DeriveApi } from '../types';
|
||||
|
||||
import { BehaviorSubject, combineLatest, map, of, switchMap, tap, toArray } from 'rxjs';
|
||||
|
||||
import { arrayChunk, arrayFlatten } from '@polkadot/util';
|
||||
import { arrayChunk, arrayFlatten, nextTick } from '@polkadot/util';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
@@ -28,13 +28,13 @@ function chunkEras <T> (eras: EraIndex[], fn: (eras: EraIndex[]) => Observable<T
|
||||
return subject.pipe(
|
||||
switchMap(fn),
|
||||
tap((): void => {
|
||||
setTimeout((): void => {
|
||||
nextTick((): void => {
|
||||
index++;
|
||||
|
||||
index === chunked.length
|
||||
? subject.complete()
|
||||
: subject.next(chunked[index]);
|
||||
}, 0);
|
||||
});
|
||||
}),
|
||||
toArray(),
|
||||
map(arrayFlatten)
|
||||
|
||||
@@ -7,3 +7,4 @@ export * from './approvalFlagsToBools';
|
||||
export * from './cache';
|
||||
export * from './cacheImpl';
|
||||
export * from './first';
|
||||
export * from './lazy';
|
||||
|
||||
Reference in New Issue
Block a user