Remove derive memos (#1538)
* Remove derive memos * Remove outer memo * Over-eager replace
This commit is contained in:
@@ -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);
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user