Merge pull request 'fix: don't crash when no follows' (#65) from fix/crash into main

Reviewed-on: Kieran/stream#65
Reviewed-by: Kieran <kieran@noreply.localhost>
This commit is contained in:
2023-08-02 09:53:47 +00:00

View File

@ -12,13 +12,14 @@ export function RootPage() {
const { live, planned, ended } = useStreamsFeed(); const { live, planned, ended } = useStreamsFeed();
const mutedHosts = new Set(getTagValues(login?.muted.tags ?? [], "p")); const mutedHosts = new Set(getTagValues(login?.muted.tags ?? [], "p"));
const tags = login?.follows.tags ?? [];
const followsHost = useCallback( const followsHost = useCallback(
(ev: NostrEvent) => { (ev: NostrEvent) => {
return login?.follows.tags.find((t) => t.at(1) === getHost(ev)); return tags.find((t) => t.at(1) === getHost(ev));
}, },
[login?.follows] [tags]
); );
const hashtags = getTagValues(login?.follows.tags ?? [], "t"); const hashtags = getTagValues(tags, "t");
const following = live.filter(followsHost); const following = live.filter(followsHost);
const liveNow = live.filter((e) => !following.includes(e)); const liveNow = live.filter((e) => !following.includes(e));
const hasFollowingLive = following.length > 0; const hasFollowingLive = following.length > 0;