mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-03 13:54:55 +03:00
fix setLastUpdated being called inside useMemo
this triggered a setState-during-render warning, so moved to a useEffect
This commit is contained in:
parent
dd6410fd5a
commit
76ecee92eb
@ -1,7 +1,7 @@
|
||||
import { CombinedStorageGraph } from "@/components/graph/CombinedStorageGraph";
|
||||
import { StorageGraph } from "@/components/graph/StorageGraph";
|
||||
import { FrigateStats } from "@/types/stats";
|
||||
import { useMemo } from "react";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
@ -56,9 +56,14 @@ export default function StorageMetrics({
|
||||
Object.values(cameraStorage).forEach(
|
||||
(cam) => (totalStorage.camera += cam.usage),
|
||||
);
|
||||
setLastUpdated(Date.now() / 1000);
|
||||
return totalStorage;
|
||||
}, [cameraStorage, stats, setLastUpdated]);
|
||||
}, [cameraStorage, stats]);
|
||||
|
||||
useEffect(() => {
|
||||
if (totalStorage) {
|
||||
setLastUpdated(Math.floor(Date.now() / 1000));
|
||||
}
|
||||
}, [totalStorage, setLastUpdated]);
|
||||
|
||||
// recordings summary
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user