fix(popular-threads): update memo comparator to include multisub entry titles

This commit is contained in:
plebeius
2026-01-03 16:04:37 +01:00
parent 4c4e1209aa
commit f5cf263481
@@ -57,8 +57,14 @@ const PopularThreadCard = memo(
</div> </div>
); );
}, },
// Custom equality: only rerender if post.cid changes // Custom equality: rerender if post.cid or multisub entry title changes
(prevProps, nextProps) => prevProps.post?.cid === nextProps.post?.cid, (prevProps, nextProps) => {
if (prevProps.post?.cid !== nextProps.post?.cid) return false;
// Compare the relevant multisub entry for this post's subplebbitAddress
const prevEntry = prevProps.multisub.find((ms) => ms?.address === prevProps.post?.subplebbitAddress);
const nextEntry = nextProps.multisub.find((ms) => ms?.address === nextProps.post?.subplebbitAddress);
return prevEntry?.title === nextEntry?.title;
},
); );
const PopularThreadsBox = ({ multisub, subplebbits }: { multisub: MultisubSubplebbit[]; subplebbits: any }) => { const PopularThreadsBox = ({ multisub, subplebbits }: { multisub: MultisubSubplebbit[]; subplebbits: any }) => {