diff --git a/src/components/views/All.jsx b/src/components/views/All.jsx index b7e7e79c..defd7b5e 100755 --- a/src/components/views/All.jsx +++ b/src/components/views/All.jsx @@ -259,14 +259,12 @@ const All = () => { const allParentCids = useMemo(() => { const allRepliesCids = Object.values(flattenedRepliesByThread).flatMap(replies => replies.map(reply => reply.cid)); const allThreadCids = selectedFeed.map(thread => thread.cid); - return [...allThreadCids, ...allRepliesCids]; + return new Set([...allThreadCids, ...allRepliesCids]); }, [flattenedRepliesByThread, selectedFeed]); - - const filter = useMemo(() => ({ - parentCids: allParentCids - }), [allParentCids]); - + + const filter = useCallback((accountComment) => allParentCids.has(accountComment.parentCid), [allParentCids]); + const { accountComments } = useAccountComments({ filter }); diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx index 62aa4625..9a0bd298 100755 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -267,14 +267,12 @@ const Board = () => { const allParentCids = useMemo(() => { const allRepliesCids = Object.values(flattenedRepliesByThread).flatMap(replies => replies.map(reply => reply.cid)); const allThreadCids = selectedFeed.map(thread => thread.cid); - return [...allThreadCids, ...allRepliesCids]; + return new Set([...allThreadCids, ...allRepliesCids]); }, [flattenedRepliesByThread, selectedFeed]); - - const filter = useMemo(() => ({ - parentCids: allParentCids - }), [allParentCids]); - + + const filter = useCallback((accountComment) => allParentCids.has(accountComment.parentCid), [allParentCids]); + const { accountComments } = useAccountComments({ filter }); diff --git a/src/components/views/Subscriptions.jsx b/src/components/views/Subscriptions.jsx index 5690c869..cf97ce33 100755 --- a/src/components/views/Subscriptions.jsx +++ b/src/components/views/Subscriptions.jsx @@ -260,14 +260,12 @@ const Subscriptions = () => { const allParentCids = useMemo(() => { const allRepliesCids = Object.values(flattenedRepliesByThread).flatMap(replies => replies.map(reply => reply.cid)); const allThreadCids = selectedFeed.map(thread => thread.cid); - return [...allThreadCids, ...allRepliesCids]; + return new Set([...allThreadCids, ...allRepliesCids]); }, [flattenedRepliesByThread, selectedFeed]); - - const filter = useMemo(() => ({ - parentCids: allParentCids - }), [allParentCids]); - + + const filter = useCallback((accountComment) => allParentCids.has(accountComment.parentCid), [allParentCids]); + const { accountComments } = useAccountComments({ filter }); diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx index f8ef95f6..b3172c18 100755 --- a/src/components/views/Thread.jsx +++ b/src/components/views/Thread.jsx @@ -242,11 +242,8 @@ const Thread = () => { ); - const filter = useMemo(() => ({ - parentCids: [ - selectedThread || 'n/a', ...flattenedReplies.map(reply => reply.cid) - ] - }), [flattenedReplies, selectedThread]); + const threadAndRepliesCids = useMemo(() => new Set([(selectedThread || 'n/a'), ...flattenedReplies.map(reply => reply.cid)]), [selectedThread, flattenedReplies]); + const filter = useCallback((accountComment) => threadAndRepliesCids.has(accountComment.parentCid), [threadAndRepliesCids]); const { accountComments } = useAccountComments({filter});