mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-09 06:55:28 +03:00
prevent review WS handler from poisoning SWR cache before initial fetch completes
This commit is contained in:
parent
365c15c9c2
commit
4e74395b0d
@ -334,7 +334,7 @@ export default function Events() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (reviewUpdate?.type === "end") {
|
if (reviewUpdate?.type === "end" && reviews) {
|
||||||
updateSegments(
|
updateSegments(
|
||||||
(data) => {
|
(data) => {
|
||||||
if (!data) return data;
|
if (!data) return data;
|
||||||
@ -348,6 +348,9 @@ export default function Events() {
|
|||||||
new Map(prev).set(reviewUpdate.after.id, reviewUpdate.after),
|
new Map(prev).set(reviewUpdate.after.id, reviewUpdate.after),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// reviews is intentionally excluded - only used to guard against
|
||||||
|
// updating the SWR cache before data has loaded
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [reviewUpdate, updateSegments]);
|
}, [reviewUpdate, updateSegments]);
|
||||||
|
|
||||||
const currentItems = useMemo(() => {
|
const currentItems = useMemo(() => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user