Re-add derive memo (def. has an impact) (#1539)

This commit is contained in:
Jaco Greeff
2019-11-03 13:28:42 +01:00
committed by GitHub
parent 487ad475c7
commit e601ae27a1
37 changed files with 206 additions and 218 deletions
@@ -8,18 +8,18 @@ import { ApiInterfaceRx } from '@polkadot/api/types';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { drr } from '../util';
import { drr, memo } from '../util';
import { overview } from './overview';
/**
* @description Retrieve latest list of validators
*/
export function validators (api: ApiInterfaceRx): () => Observable<AccountId[]> {
export const validators = memo((api: ApiInterfaceRx): () => Observable<AccountId[]> => {
const overviewCall = overview(api);
return (): Observable<AccountId[]> =>
return memo((): Observable<AccountId[]> =>
overviewCall().pipe(
map(({ validators }): AccountId[] => validators),
drr()
);
}
));
}, true);