Remove double-up-drr (memo vs rpc) (#1541)

* Remove inner memo (no double-up on stringify)

* Validators-specific query
This commit is contained in:
Jaco Greeff
2019-11-03 23:47:55 +01:00
committed by GitHub
parent d39878c875
commit 2371d6a29c
38 changed files with 100 additions and 93 deletions
+2 -2
View File
@@ -14,9 +14,9 @@ import { info } from './info';
export const eraLength = memo((api: ApiInterfaceRx): () => Observable<BlockNumber> => {
const infoCall = info(api);
return memo((): Observable<BlockNumber> =>
return (): Observable<BlockNumber> =>
infoCall().pipe(
map(({ eraLength }): BlockNumber => eraLength),
drr()
));
);
}, true);
@@ -14,9 +14,9 @@ import { info } from './info';
export const eraProgress = memo((api: ApiInterfaceRx): () => Observable<BlockNumber> => {
const infoCall = info(api);
return memo((): Observable<BlockNumber> =>
return (): Observable<BlockNumber> =>
infoCall().pipe(
map(({ eraProgress }): BlockNumber => eraProgress),
drr()
));
);
}, true);
+2 -2
View File
@@ -13,7 +13,7 @@ import { u32 } from '@polkadot/types';
import { drr, memo } from '../util';
export const indexes = memo((api: ApiInterfaceRx): () => Observable<DeriveSessionIndexes> => {
return memo((): Observable<DeriveSessionIndexes> =>
return (): Observable<DeriveSessionIndexes> =>
api.queryMulti<[SessionIndex, EraIndex, u32]>([
api.query.session.currentIndex,
api.query.staking.currentEra,
@@ -23,5 +23,5 @@ export const indexes = memo((api: ApiInterfaceRx): () => Observable<DeriveSessio
currentIndex, currentEra, validatorCount
})),
drr()
));
);
}, true);
+2 -2
View File
@@ -138,6 +138,6 @@ export const info = memo((api: ApiInterfaceRx): () => Observable<DerivedSessionI
: infoLatestAura // 2.x with Aura (not all info there)
: infoV1;
return memo((): Observable<DerivedSessionInfo> =>
query(api, calls).pipe(drr()));
return (): Observable<DerivedSessionInfo> =>
query(api, calls).pipe(drr());
}, true);
@@ -14,9 +14,9 @@ import { info } from './info';
export const sessionProgress = memo((api: ApiInterfaceRx): () => Observable<BlockNumber> => {
const infoCall = info(api);
return memo((): Observable<BlockNumber> =>
return (): Observable<BlockNumber> =>
infoCall().pipe(
map(({ sessionProgress }): BlockNumber => sessionProgress),
drr()
));
);
}, true);