fix: reduce reloads for timeline
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
64ad548d75
commit
dc4758d302
@ -28,7 +28,7 @@ export default function TimelineChunk(props: TimelineChunkProps) {
|
|||||||
f.since(props.chunk.since).until(props.chunk.until);
|
f.since(props.chunk.since).until(props.chunk.until);
|
||||||
}
|
}
|
||||||
return rb;
|
return rb;
|
||||||
}, [props.id, props.chunk, props.builder]);
|
}, [props.id, props.chunk.until, props.builder]);
|
||||||
|
|
||||||
const feed = useRequestBuilder(sub);
|
const feed = useRequestBuilder(sub);
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import "./Timeline.css";
|
|||||||
|
|
||||||
import { unixNow } from "@snort/shared";
|
import { unixNow } from "@snort/shared";
|
||||||
import { EventKind, NostrEvent, RequestBuilder } from "@snort/system";
|
import { EventKind, NostrEvent, RequestBuilder } from "@snort/system";
|
||||||
import { ReactNode, useState } from "react";
|
import { ReactNode, useCallback, useState } from "react";
|
||||||
|
|
||||||
import { DisplayAs, DisplayAsSelector } from "@/Components/Feed/DisplayAsSelector";
|
import { DisplayAs, DisplayAsSelector } from "@/Components/Feed/DisplayAsSelector";
|
||||||
import useFollowsControls from "@/Hooks/useFollowControls";
|
import useFollowsControls from "@/Hooks/useFollowControls";
|
||||||
@ -41,14 +41,20 @@ const TimelineFollows = (props: TimelineFollowsProps) => {
|
|||||||
firstChunkSize: Hour * 2,
|
firstChunkSize: Hour * 2,
|
||||||
});
|
});
|
||||||
|
|
||||||
const builder = (rb: RequestBuilder) => {
|
const builder = useCallback(
|
||||||
rb.withFilter().authors(followList).kinds([EventKind.TextNote, EventKind.Repost, EventKind.Polls]);
|
(rb: RequestBuilder) => {
|
||||||
};
|
rb.withFilter().authors(followList).kinds([EventKind.TextNote, EventKind.Repost, EventKind.Polls]);
|
||||||
|
},
|
||||||
|
[followList],
|
||||||
|
);
|
||||||
|
|
||||||
const filterEvents = (a: NostrEvent) =>
|
const filterEvents = useCallback(
|
||||||
(props.noteFilter?.(a) ?? true) &&
|
(a: NostrEvent) =>
|
||||||
(props.postsOnly ? !a.tags.some(b => b[0] === "e" || b[0] === "a") : true) &&
|
(props.noteFilter?.(a) ?? true) &&
|
||||||
(isFollowing(a.pubkey) || a.tags.filter(a => a[0] === "t").length < 5);
|
(props.postsOnly ? !a.tags.some(b => b[0] === "e" || b[0] === "a") : true) &&
|
||||||
|
(isFollowing(a.pubkey) || a.tags.filter(a => a[0] === "t").length < 5),
|
||||||
|
[props.noteFilter, props.postsOnly, followList],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user