Simplify makeSelectViewersForId
This commit is contained in:
parent
6b6879ba64
commit
01f771c6ca
2 changed files with 8 additions and 6 deletions
|
@ -1,13 +1,13 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doFetchSubCount, selectSubCountForUri } from 'lbryinc';
|
||||
import { selectTitleForUri, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectTitleForUri, selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { makeSelectInsufficientCreditsForUri } from 'redux/selectors/content';
|
||||
import { makeSelectViewersForId } from 'redux/selectors/livestream';
|
||||
import { selectViewersForId } from 'redux/selectors/livestream';
|
||||
import FileTitleSection from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = makeSelectClaimForUri(props.uri)(state);
|
||||
const viewers = claim && makeSelectViewersForId(claim.claim_id)(state);
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
const viewers = claim && selectViewersForId(state, claim.claim_id);
|
||||
const channelClaimId = claim && claim.signing_channel ? claim.signing_channel.claim_id : undefined;
|
||||
const channelUri = claim && claim.signing_channel ? claim.signing_channel.canonical_url : undefined;
|
||||
const subCount = channelUri && selectSubCountForUri(state, channelUri);
|
||||
|
|
|
@ -29,8 +29,10 @@ export const selectViewersById = (state: State) => selectState(state).viewersByI
|
|||
export const makeSelectIsFetchingLivestreams = (channelId: string) =>
|
||||
createSelector(selectFetchingLivestreams, (fetchingLivestreams) => Boolean(fetchingLivestreams[channelId]));
|
||||
|
||||
export const makeSelectViewersForId = (channelId: string) =>
|
||||
createSelector(selectViewersById, (viewers) => viewers[channelId]);
|
||||
export const selectViewersForId = (state: State, channelId: string) => {
|
||||
const viewers = selectViewersById(state);
|
||||
return viewers[channelId];
|
||||
};
|
||||
|
||||
export const makeSelectPendingLivestreamsForChannelId = (channelId: string) =>
|
||||
createSelector(selectPendingClaims, (pendingClaims) => {
|
||||
|
|
Loading…
Reference in a new issue