fix(sim): re-solve when a part burns out so the open actually applies

The live solver only re-solved on component/wire/board changes, so a runtime
burnout (which changes burntComponents, not components) wouldn't rebuild the
netlist — the burnt part stayed in the circuit until something else changed.
Trigger a re-solve on burntComponents change too. The monitor skips already-
burnt parts, so this converges (one extra solve).
This commit is contained in:
David Montero 2026-06-18 05:10:00 +02:00
parent 25d5e539ab
commit 1a7d4fabf4
1 changed files with 8 additions and 1 deletions

View File

@ -391,7 +391,14 @@ export class CircuitSimulationService {
const unsubscribe = this.simStore.subscribe((next, prev) => {
const n = next as ReturnType<typeof this.simStore.getState>;
const p = prev as ReturnType<typeof this.simStore.getState>;
if (n.components !== p.components || n.wires !== p.wires || n.boards !== p.boards) {
if (
n.components !== p.components ||
n.wires !== p.wires ||
n.boards !== p.boards ||
// P4: a part burning out (or a Reset un-burning it) changes which
// components are in the netlist, so re-solve to apply the open.
n.burntComponents !== p.burntComponents
) {
void this.tick();
}
});