From f7f0eb4ba8aff351d7bb7192db068de790eaf768 Mon Sep 17 00:00:00 2001 From: David Montero Date: Wed, 17 Jun 2026 21:02:57 +0200 Subject: [PATCH] fix(editor): Run button bypassed circuit pre-flight verification The Run (and Run All) buttons were wired `onClick={handleRun}`, so React passed the click event as the first argument. handleRun(skipVerify=false) then treated the truthy event as skipVerify=true and skipped checkOrBlock entirely -- the pre-flight circuit verifier never ran on a button click. This is the real reason a 9V battery wired straight to an LED ran with no warning even though the verifier exists and is correct (project 2840fd12). - onClick={() => handleRun()} and onClick={() => handleRunAll()} so skipVerify stays at its false default. - Give handleRunAll the same checkOrBlock pre-flight gate handleRun has. --- frontend/src/components/editor/EditorToolbar.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/editor/EditorToolbar.tsx b/frontend/src/components/editor/EditorToolbar.tsx index e0433967..15e432e8 100644 --- a/frontend/src/components/editor/EditorToolbar.tsx +++ b/frontend/src/components/editor/EditorToolbar.tsx @@ -1068,12 +1068,19 @@ export const EditorToolbar = ({ * fresh WASM/ROM) + resuming the electrical solver when there's no board. * Mirrors single Run, generalised across all targets. */ - const handleRunAll = async () => { + const handleRunAll = async (skipVerify = false) => { const sim = useSimulatorStore.getState(); const boardsList = sim.boards; const chips = sim.components.filter((c) => c.metadataId === 'custom-chip'); if (boardsList.length === 0 && chips.length === 0) return; + // Same pre-flight safety check as handleRun — block on shorts / overcurrent + // before starting every board, with a "Run anyway" escape. + if (!skipVerify) { + const ok = await checkOrBlock(() => handleRunAll(true)); + if (!ok) return; + } + // A chip needs compiling when it has no WASM yet, or it references a program // file but hasn't been assembled to ROM. const chipNeedsCompile = chips.some((c) => { @@ -1392,7 +1399,7 @@ export const EditorToolbar = ({ {/* Run */}