don't refetch data on refocus

This commit is contained in:
Blake Blackshear 2022-07-07 07:05:05 -05:00
parent b36b63599b
commit b80080ac52

View File

@ -15,13 +15,13 @@ export default function Recording({ camera, date, hour = '00', minute = '00', se
); );
const apiHost = useApiHost(); const apiHost = useApiHost();
const { data: recordingsSummary } = useSWR(`${camera}/recordings/summary`); const { data: recordingsSummary } = useSWR(`${camera}/recordings/summary`, { revalidateOnFocus: false });
const recordingParams = { const recordingParams = {
before: getUnixTime(endOfHour(currentDate)), before: getUnixTime(endOfHour(currentDate)),
after: getUnixTime(startOfHour(currentDate)), after: getUnixTime(startOfHour(currentDate)),
}; };
const { data: recordings } = useSWR([`${camera}/recordings`, recordingParams]); const { data: recordings } = useSWR([`${camera}/recordings`, recordingParams], { revalidateOnFocus: false });
// calculates the seek seconds by adding up all the seconds in the segments prior to the playback time // calculates the seek seconds by adding up all the seconds in the segments prior to the playback time
const seekSeconds = useMemo(() => { const seekSeconds = useMemo(() => {