Remove derive memos (#1538)

* Remove derive memos

* Remove outer memo

* Over-eager replace
This commit is contained in:
Jaco Greeff
2019-11-03 11:38:36 +01:00
committed by GitHub
parent 0e037de1b1
commit 506b042f8c
44 changed files with 273 additions and 305 deletions
@@ -11,15 +11,15 @@ import { ApiInterfaceRx } from '@polkadot/api/types';
import { Bytes, Option, u32 } from '@polkadot/types';
import { overview as stakingOverview } from '../staking';
import { drr, memo } from '../util';
import { drr } from '../util';
/**
* @description Return a boolean array indicating whether the passed accounts had received heartbeats in the current session
*/
export const receivedHeartbeats = memo((api: ApiInterfaceRx): () => Observable<DerivedHeartbeats> => {
export function receivedHeartbeats (api: ApiInterfaceRx): () => Observable<DerivedHeartbeats> {
const stakingOverviewvCall = stakingOverview(api);
return memo((): Observable<DerivedHeartbeats> => {
return (): Observable<DerivedHeartbeats> => {
return api.query.imOnline && api.query.imOnline.receivedHeartbeats && api.query.imOnline.authoredBlocks
? stakingOverviewvCall().pipe(
switchMap(({ currentIndex, validators }): Observable<[AccountId[], Option<Bytes>[], u32[]]> =>
@@ -42,5 +42,5 @@ export const receivedHeartbeats = memo((api: ApiInterfaceRx): () => Observable<D
drr()
)
: of({});
});
}, true);
};
}