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
@@ -9,7 +9,7 @@ import { map, startWith } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { indexes, AccountIndexes } from './indexes';
import { drr, memo } from '../util';
import { drr } from '../util';
/**
* @name idToIndex
@@ -25,16 +25,15 @@ import { drr, memo } from '../util';
* });
* ```
*/
export const idToIndex = memo((api: ApiInterfaceRx): (accountId: AccountId | string) => Observable<AccountIndex | undefined> => {
export function idToIndex (api: ApiInterfaceRx): (accountId: AccountId | string) => Observable<AccountIndex | undefined> {
const indexesCall = indexes(api);
return memo((accountId: AccountId | string): Observable<AccountIndex | undefined> =>
return (accountId: AccountId | string): Observable<AccountIndex | undefined> =>
indexesCall().pipe(
startWith({}),
map((indexes: AccountIndexes): AccountIndex | undefined =>
(indexes || {})[accountId.toString()]
),
drr()
)
);
}, true);
);
}