From 55276c19fe988b96477eec049bd82651802d8db3 Mon Sep 17 00:00:00 2001 From: Simone Cavalli Date: Sat, 13 Jun 2026 15:51:41 +0200 Subject: [PATCH] fix(11-03): avoid setState/ref access during render in EditableCell - remove value-sync useEffect + render-time ref read that violated react-hooks/set-state-in-effect and react-hooks/refs lint rules - toggle display now reads value directly instead of tempValue, which is only meaningful while isEditing is true --- src/components/ui/editable-cell.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/ui/editable-cell.tsx b/src/components/ui/editable-cell.tsx index 230d5c5..4dea4c2 100644 --- a/src/components/ui/editable-cell.tsx +++ b/src/components/ui/editable-cell.tsx @@ -29,10 +29,6 @@ export function EditableCell({ const [error, setError] = useState(null); const inputRef = useRef(null); - useEffect(() => { - setTempValue(String(value)); - }, [value]); - useEffect(() => { if (isEditing && inputRef.current) { inputRef.current.focus(); @@ -78,7 +74,7 @@ export function EditableCell({ if (!isEditing) { let display: string; if (type === "toggle") { - display = tempValue === "true" ? "✓ Attivo" : "✗ Disattivato"; + display = String(value) === "true" ? "✓ Attivo" : "✗ Disattivato"; } else { const raw = String(value); display = formatDisplay ? formatDisplay(raw) : raw || "—";