lbry-desktop/ui/component/previewLink/index.js
infinite-persistence 201a826381
Simplify makeSelectIsUriResolving
- Memo not required. `resolvingUris` is very dynamic and is a short array anyways.
- Changeg from using `indexOf` to `includes`, which is more concise.
2021-11-16 14:32:58 +08:00

33 lines
997 B
JavaScript

import { connect } from 'react-redux';
import {
selectClaimIsMine,
selectTitleForUri,
getThumbnailFromClaim,
selectClaimForUri,
selectIsUriResolving,
makeSelectMetadataItemForUri,
} from 'redux/selectors/claims';
import { doResolveUri } from 'redux/actions/claims';
import { selectBlackListedOutpoints } from 'lbryinc';
import PreviewLink from './view';
const select = (state, props) => {
const claim = selectClaimForUri(state, props.uri);
return {
uri: props.uri,
claim,
title: selectTitleForUri(state, props.uri),
thumbnail: getThumbnailFromClaim(claim),
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
channelIsMine: selectClaimIsMine(state, claim),
isResolvingUri: selectIsUriResolving(state, props.uri),
blackListedOutpoints: selectBlackListedOutpoints(state),
};
};
const perform = (dispatch) => ({
resolveUri: (uri) => dispatch(doResolveUri(uri)),
});
export default connect(select, perform)(PreviewLink);