Re-add derive memo (def. has an impact) (#1539)

This commit is contained in:
Jaco Greeff
2019-11-03 13:28:42 +01:00
committed by GitHub
parent 487ad475c7
commit e601ae27a1
37 changed files with 206 additions and 218 deletions
+5 -5
View File
@@ -9,7 +9,7 @@ import BN from 'bn.js';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { drr } from '../util';
import { drr, memo } from '../util';
type ResultV2 = [BN, BN, BN, BN, BN, BN, BN, BN, BN, BN];
@@ -103,8 +103,8 @@ function queryConstants (api: ApiInterfaceRx): Observable<ResultV2> {
* });
* ```
*/
export function fees (api: ApiInterfaceRx): () => Observable<DerivedContractFees> {
return (): Observable<DerivedContractFees> => {
export const fees = memo((api: ApiInterfaceRx): () => Observable<DerivedContractFees> => {
return memo((): Observable<DerivedContractFees> => {
if (api.query.contract && !api.query.contract.rentByteFee) {
return queryV1(api);
}
@@ -122,5 +122,5 @@ export function fees (api: ApiInterfaceRx): () => Observable<DerivedContractFees
),
drr()
);
};
}
});
}, true);