From 40c3f904af4ffa68a61388e2e7b5b587a55eef65 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sun, 8 Feb 2026 18:32:16 +0100 Subject: [PATCH] fixed issues --- src/app/runs/[runId]/components/Editor.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/runs/[runId]/components/Editor.tsx b/src/app/runs/[runId]/components/Editor.tsx index 52035c4..c2160bf 100644 --- a/src/app/runs/[runId]/components/Editor.tsx +++ b/src/app/runs/[runId]/components/Editor.tsx @@ -50,9 +50,10 @@ export default function Editor({ run }: { run: LiveRun | null | undefined }) { const [_, setLastMoveId] = useState(-1); const [moves, setMoves] = useState([]); + const [movesLoading, setMovesLoading] = useState(false); useEffect(() => { - if (!rawMoves || rawMoves.length === 0) return; + if (!rawMoves || rawMoves.length === 0 || movesLoading) return; setLastMoveId((prevLastMoveId) => { const newMoves = rawMoves.filter((move) => move.moveId > prevLastMoveId); @@ -63,7 +64,7 @@ export default function Editor({ run }: { run: LiveRun | null | undefined }) { return Math.max(...newMoves.map((m) => m.moveId)); }); - }, [rawMoves]); + }, [rawMoves, movesLoading]); useEffect(() => { if (!editorView || !moves) return; @@ -90,10 +91,12 @@ export default function Editor({ run }: { run: LiveRun | null | undefined }) { (async () => { if (!moves) return; + setMovesLoading(true); for (const move of moves) { if (cancelled) break; await executeMove(move); } + setMovesLoading(false); })(); return () => {