Re-add derive memo (def. has an impact) (#1539)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user