Use a lighter selector that doesn't re-create an array of claims.

Although selectClaimsByUri is memoized, it is often invalidated. Why create the array when all we need is the claim?
This commit is contained in:
infinite-persistence 2021-11-16 10:47:59 +08:00
parent 73f208923a
commit dae0e3ccae
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -1,12 +1,12 @@
import * as ACTIONS from 'constants/action_types';
import { Lbryio } from 'lbryinc';
import { selectClaimsByUri } from 'redux/selectors/claims';
import { selectClaimForUri } from 'redux/selectors/claims';
// eslint-disable-next-line import/prefer-default-export
export function doFetchCostInfoForUri(uri) {
return (dispatch, getState) => {
const state = getState();
const claim = selectClaimsByUri(state)[uri];
const claim = selectClaimForUri(state, uri);
if (!claim) return;