mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-03 18:41:14 +03:00
use stable empty object reference for swr metadata default
This commit is contained in:
parent
2cfb530dbf
commit
95e20d3fd5
@ -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 emptyObject = Object.freeze({});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 = emptyObject } = useSWR<{
|
||||||
[key: string]: LiveStreamMetadata;
|
[key: string]: LiveStreamMetadata;
|
||||||
}>(swrKey, fetcher, {
|
}>(swrKey, fetcher, {
|
||||||
revalidateOnFocus: false,
|
revalidateOnFocus: false,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user