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:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user