rollback fix
All checks were successful
Deploy on Master Change / deploy (push) Successful in 1m23s

This commit is contained in:
2026-07-13 15:14:50 +07:00
parent 24a4ef2c66
commit 31943bf489

View File

@@ -31,9 +31,13 @@ export const ExamGridProctor: React.FC<ExamGridProctorProps> = ({
); );
const onlineKey = useMemo(() => onlineIds.join(','), [onlineIds]); const onlineKey = useMemo(() => onlineIds.join(','), [onlineIds]);
const onlineIdsRef = useRef<number[]>(onlineIds);
onlineIdsRef.current = onlineIds;
const syncSubscriptions = (ws: WebSocket) => { const syncSubscriptions = (ws: WebSocket) => {
if (ws.readyState !== WebSocket.OPEN) return; if (ws.readyState !== WebSocket.OPEN) return;
const target = new Set(onlineIds); const currentOnlineIds = onlineIdsRef.current;
const target = new Set(currentOnlineIds);
const prev = subscribedRef.current; const prev = subscribedRef.current;
prev.forEach((id) => { prev.forEach((id) => {
@@ -42,7 +46,7 @@ export const ExamGridProctor: React.FC<ExamGridProctorProps> = ({
prev.delete(id); prev.delete(id);
} }
}); });
onlineIds.forEach((id) => { currentOnlineIds.forEach((id) => {
if (!prev.has(id)) { if (!prev.has(id)) {
ws.send(JSON.stringify({ event: 'teacher:subscribe', data: { studentId: id } })); ws.send(JSON.stringify({ event: 'teacher:subscribe', data: { studentId: id } }));
prev.add(id); prev.add(id);