bug: filter latestFeed

This commit is contained in:
Kieran 2023-01-21 23:01:55 +00:00
parent 61106c5d19
commit e1b6e12b05
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -32,7 +32,7 @@ export default function Timeline({ subject, postsOnly = false, method }: Timelin
}, [main]); }, [main]);
const latestFeed = useMemo(() => { const latestFeed = useMemo(() => {
return filterPosts(latest.notes); return filterPosts(latest.notes).filter(a => !mainFeed.some(b => b.id === a.id));
}, [latest]); }, [latest]);
function eventElement(e: TaggedRawEvent) { function eventElement(e: TaggedRawEvent) {
@ -52,7 +52,7 @@ export default function Timeline({ subject, postsOnly = false, method }: Timelin
{latestFeed.length > 1 && (<div className="card latest-notes pointer" onClick={() => showLatest()}> {latestFeed.length > 1 && (<div className="card latest-notes pointer" onClick={() => showLatest()}>
<FontAwesomeIcon icon={faForward} size="xl"/> <FontAwesomeIcon icon={faForward} size="xl"/>
&nbsp; &nbsp;
Show latest {latestFeed.length} notes Show latest {latestFeed.length - 1} notes
</div>)} </div>)}
{mainFeed.map(eventElement)} {mainFeed.map(eventElement)}
{mainFeed.length > 0 ? <LoadMore onLoadMore={loadMore} /> : null} {mainFeed.length > 0 ? <LoadMore onLoadMore={loadMore} /> : null}