prevent review WS handler from poisoning SWR cache before initial fetch completes

This commit is contained in:
Josh Hawkins 2026-04-15 20:55:07 -05:00
parent 365c15c9c2
commit 4e74395b0d

View File

@ -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(() => {