fix: resolve 9 P0+P1 review findings (bills decorators, campus isolation bypass, ding raw crash, batch import counter, SSE multi-tab, interval leak, dept permissions, cycle prevention, tree depth)

This commit is contained in:
2026-07-06 00:38:51 +08:00
parent 90b6ce4aba
commit b3655da012
8 changed files with 75 additions and 6 deletions

View File

@@ -58,6 +58,7 @@ const NotificationBell: React.FC = () => {
};
const openRef = useRef(open);
openRef.current = open;
const retryRef = useRef<number | null>(null);
// SSE connection — decoupled from popover open state
useEffect(() => {
@@ -74,9 +75,14 @@ const NotificationBell: React.FC = () => {
};
es.onerror = () => {
es.close();
setInterval(fetchUnread, 60_000);
if (retryRef.current !== null) clearInterval(retryRef.current);
retryRef.current = window.setInterval(fetchUnread, 60_000);
};
return () => {
es.close();
clearInterval(retryRef.current ?? undefined);
retryRef.current = null;
};
return () => es.close();
}, []);
const handleOpen = (visible: boolean) => {