refactor: cache since, dont dedupe by host

This commit is contained in:
2023-08-01 07:58:12 +02:00
parent 5026f6a008
commit 58c55f17b6
4 changed files with 32 additions and 57 deletions

View File

@ -11,9 +11,10 @@ import { useMemo } from "react";
import { LIVE_STREAM_CHAT } from "const";
export function useLiveChatFeed(link: NostrLink, eZaps?: Array<string>) {
const since = useMemo(() =>
unixNow() - (60 * 60 * 24 * 7), // 7-days of zaps
[link.id]);
const since = useMemo(
() => unixNow() - 60 * 60 * 24 * 7, // 7-days of zaps
[link.id],
);
const sub = useMemo(() => {
const rb = new RequestBuilder(`live:${link.id}:${link.author}`);
rb.withOptions({
@ -57,7 +58,7 @@ export function useLiveChatFeed(link: NostrLink, eZaps?: Array<string>) {
const reactionsSub = useRequestBuilder<FlatNoteStore>(
System,
FlatNoteStore,
esub
esub,
);
const reactions = reactionsSub.data ?? [];