fix: resolve all 25 ESLint react-hooks and react-refresh violations

Replace useEffect-based state resets in dialogs with React's render-time
state adjustment pattern. Wrap ref assignments in hooks with useEffect.
Suppress known third-party library warnings (shadcn CVA exports,
TanStack Table). Remove warn downgrades from eslint config.
This commit was merged in pull request #1.
This commit is contained in:
2026-04-08 07:41:34 +03:00
parent 9237c7dd8e
commit 2d2dcdc4a8
20 changed files with 145 additions and 67 deletions

View File

@@ -36,20 +36,31 @@ export function useDataGenerator() {
});
useEffect(() => {
const unlistenPromise = onDataGenProgress((p) => {
if (p.gen_id === genIdRef.current) {
let mounted = true;
let unlisten: (() => void) | undefined;
onDataGenProgress((p) => {
if (mounted && p.gen_id === genIdRef.current) {
setProgress(p);
}
}).then((fn) => {
if (mounted) {
unlisten = fn;
} else {
fn();
}
});
return () => {
unlistenPromise.then((unlisten) => unlisten());
mounted = false;
unlisten?.();
};
}, []);
const previewRef = useRef(previewMutation);
previewRef.current = previewMutation;
const insertRef = useRef(insertMutation);
insertRef.current = insertMutation;
useEffect(() => {
previewRef.current = previewMutation;
insertRef.current = insertMutation;
});
const reset = useCallback(() => {
previewRef.current.reset();