ClaimList: fix render due to un-memo'd callback.
This commit is contained in:
parent
b4f62e78de
commit
b8c763f749
1 changed files with 17 additions and 12 deletions
|
@ -94,11 +94,21 @@ export default function ClaimList(props: Props) {
|
||||||
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
|
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleClaimClicked(e, claim, index) {
|
const handleClaimClicked = React.useCallback(
|
||||||
if (onClick) {
|
(e, claim, index) => {
|
||||||
onClick(e, claim, index);
|
if (onClick) {
|
||||||
}
|
onClick(e, claim, index);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
[onClick]
|
||||||
|
);
|
||||||
|
|
||||||
|
const customShouldHide = React.useCallback((claim: StreamClaim) => {
|
||||||
|
// Hack to hide spee.ch thumbnail publishes
|
||||||
|
// If it meets these requirements, it was probably uploaded here:
|
||||||
|
// https://github.com/lbryio/lbry-redux/blob/master/src/redux/actions/publish.js#L74-L79
|
||||||
|
return claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch';
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleScroll = debounce((e) => {
|
const handleScroll = debounce((e) => {
|
||||||
|
@ -195,13 +205,8 @@ export default function ClaimList(props: Props) {
|
||||||
showHiddenByUser={showHiddenByUser}
|
showHiddenByUser={showHiddenByUser}
|
||||||
collectionId={collectionId}
|
collectionId={collectionId}
|
||||||
showNoSourceClaims={showNoSourceClaims}
|
showNoSourceClaims={showNoSourceClaims}
|
||||||
customShouldHide={(claim: StreamClaim) => {
|
customShouldHide={customShouldHide}
|
||||||
// Hack to hide spee.ch thumbnail publishes
|
onClick={handleClaimClicked}
|
||||||
// If it meets these requirements, it was probably uploaded here:
|
|
||||||
// https://github.com/lbryio/lbry-redux/blob/master/src/redux/actions/publish.js#L74-L79
|
|
||||||
return claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch';
|
|
||||||
}}
|
|
||||||
onClick={(e, claim, index) => handleClaimClicked(e, claim, index)}
|
|
||||||
/>
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
|
|
Loading…
Reference in a new issue