This commit is contained in:
Eric W 2026-04-21 18:50:47 -04:00 committed by GitHub
commit 0880937993
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,7 @@ import { LiveStreamMetadata } from "@/types/live";
const FETCH_TIMEOUT_MS = 10000; const FETCH_TIMEOUT_MS = 10000;
const DEFER_DELAY_MS = 2000; const DEFER_DELAY_MS = 2000;
const EMPTY_METADATA: { [key: string]: LiveStreamMetadata } = {};
/** /**
* Hook that fetches go2rtc stream metadata with deferred loading. * Hook that fetches go2rtc stream metadata with deferred loading.
@ -77,7 +78,7 @@ export default function useDeferredStreamMetadata(streamNames: string[]) {
return metadata; return metadata;
}, []); }, []);
const { data: metadata = {} } = useSWR<{ const { data: metadata = EMPTY_METADATA } = useSWR<{
[key: string]: LiveStreamMetadata; [key: string]: LiveStreamMetadata;
}>(swrKey, fetcher, { }>(swrKey, fetcher, {
revalidateOnFocus: false, revalidateOnFocus: false,