lbry-desktop/ui/page/listBlocked/index.js
jessopb ca0cd2ca75
Use 'selectHasChannel' instead of the full 'selectMyChannelClaims' (#7427)
- selectMyChannelClaims depends on `byId`, which currently is always invalidated per update, so it is not memoized.

- Most of the use-cases just needs the ID or the length of the array anyways, so avoid generating a Claim array (in selectMyChannelClaims) unnecessarily -- the client need to reduce it back down to IDs again :/

- The simpler boolean also removes the need to memoize the selector, which saves a bit of memory.

Co-authored-by: infinite-persistence <inf.persistence@gmail.com>
2022-01-21 12:38:11 -05:00

37 lines
1.5 KiB
JavaScript

import { connect } from 'react-redux';
import { doFetchModBlockedList, doFetchCommentModAmIList } from 'redux/actions/comments';
import { selectMutedChannels } from 'redux/selectors/blocked';
import {
selectModerationBlockList,
selectAdminBlockList,
selectModeratorBlockList,
selectModeratorBlockListDelegatorsMap,
selectFetchingModerationBlockList,
selectModerationDelegatorsById,
selectAdminTimeoutMap,
selectModeratorTimeoutMap,
selectPersonalTimeoutMap,
} from 'redux/selectors/comments';
import { selectMyChannelClaimIds } from 'redux/selectors/claims';
import ListBlocked from './view';
const select = (state) => ({
mutedUris: selectMutedChannels(state),
personalBlockList: selectModerationBlockList(state),
adminBlockList: selectAdminBlockList(state),
moderatorBlockList: selectModeratorBlockList(state),
personalTimeoutMap: selectPersonalTimeoutMap(state),
adminTimeoutMap: selectAdminTimeoutMap(state),
moderatorTimeoutMap: selectModeratorTimeoutMap(state),
moderatorBlockListDelegatorsMap: selectModeratorBlockListDelegatorsMap(state),
delegatorsById: selectModerationDelegatorsById(state),
myChannelClaimIds: selectMyChannelClaimIds(state),
fetchingModerationBlockList: selectFetchingModerationBlockList(state),
});
const perform = (dispatch) => ({
fetchModBlockedList: () => dispatch(doFetchModBlockedList()),
fetchModAmIList: () => dispatch(doFetchCommentModAmIList()),
});
export default connect(select, perform)(ListBlocked);