Fix memomization on BigInt values (#2728)

This commit is contained in:
Jaco Greeff
2020-10-15 08:59:48 +02:00
committed by GitHub
parent 393c677a16
commit d47faa4687
3 changed files with 18 additions and 5 deletions
+2 -2
View File
@@ -4,6 +4,7 @@
import createMemo from 'memoizee';
import { Observable, Observer, TeardownLogic } from 'rxjs';
import { drr } from '@polkadot/rpc-core/rxjs';
import normalizer from '@polkadot/rpc-core/normalizer';
type ObsFn <T> = (...params: any[]) => Observable<T>;
@@ -24,8 +25,7 @@ export function memo <T> (instanceId: string, inner: ObsFn<T>): ObsFn<T> {
}).pipe(drr()),
{
// Normalize via JSON.stringify, allow e.g. AccountId -> ss58
// eslint-disable-next-line @typescript-eslint/unbound-method
normalizer: (args) => instanceId + JSON.stringify(args)
normalizer: normalizer(instanceId)
}
);