fix(ci): stop writing dialog close refs during render

eslint-plugin-react-hooks forbids updating ref.current in render, which failed staging lint after the compact rectification board landed.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-20 16:20:39 +08:00
parent fb0df7f62f
commit dbbcb71b6a
3 changed files with 21 additions and 4 deletions
@@ -208,8 +208,6 @@ export function RectificationBoard({
onClose: () => void;
}>) {
const dialogRef = useRef<HTMLDialogElement>(null);
const onCloseRef = useRef(onClose);
onCloseRef.current = onClose;
const body = (
<RectificationBoardBody
result={result}
@@ -235,10 +233,10 @@ export function RectificationBoard({
if (!compact) return;
const node = dialogRef.current;
if (!node) return;
const handleClose = () => onCloseRef.current();
const handleClose = () => onClose();
node.addEventListener("close", handleClose);
return () => node.removeEventListener("close", handleClose);
}, [compact]);
}, [compact, onClose]);
if (compact) {
return (