From bc8ca7d1a674e2ae17d76b25fe47afcdda81af1f Mon Sep 17 00:00:00 2001 From: techmannih Date: Sat, 25 Oct 2025 03:21:36 +0530 Subject: [PATCH 1/3] Fix trace issue with KiCad footprints --- lib/components/base-components/Renderable.ts | 6 +++ ...sx-selectors-thickness-kicadd-pcb.snap.svg | 1 + .../trace-pcb-path-selectors.test.tsx | 53 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 tests/components/primitive-components/__snapshots__/trace-pcb-path-selectors.test.tsx-selectors-thickness-kicadd-pcb.snap.svg diff --git a/lib/components/base-components/Renderable.ts b/lib/components/base-components/Renderable.ts index 63fd9fd17..d41e5faa0 100644 --- a/lib/components/base-components/Renderable.ts +++ b/lib/components/base-components/Renderable.ts @@ -332,6 +332,12 @@ export abstract class Renderable implements IRenderable { } runRenderPhaseForChildren(phase: RenderPhase): void { + const deps = asyncPhaseDependencies[phase] || [] + for (const depPhase of deps) { + if (this._hasIncompleteAsyncEffectsInSubtreeForPhase(depPhase)) { + return + } + } for (const child of this.children) { child.runRenderPhaseForChildren(phase) child.runRenderPhase(phase) diff --git a/tests/components/primitive-components/__snapshots__/trace-pcb-path-selectors.test.tsx-selectors-thickness-kicadd-pcb.snap.svg b/tests/components/primitive-components/__snapshots__/trace-pcb-path-selectors.test.tsx-selectors-thickness-kicadd-pcb.snap.svg new file mode 100644 index 000000000..6a43dee57 --- /dev/null +++ b/tests/components/primitive-components/__snapshots__/trace-pcb-path-selectors.test.tsx-selectors-thickness-kicadd-pcb.snap.svg @@ -0,0 +1 @@ +R1R1R1R2R2R2 \ No newline at end of file diff --git a/tests/components/primitive-components/trace-pcb-path-selectors.test.tsx b/tests/components/primitive-components/trace-pcb-path-selectors.test.tsx index da2108cf3..2c40368ca 100644 --- a/tests/components/primitive-components/trace-pcb-path-selectors.test.tsx +++ b/tests/components/primitive-components/trace-pcb-path-selectors.test.tsx @@ -1,5 +1,6 @@ import { test, expect } from "bun:test" import { getTestFixture } from "tests/fixtures/get-test-fixture" +import external0402Footprint from "tests/fixtures/assets/external-0402-footprint.json" test("trace pcbPath supports selectors", async () => { const { circuit } = getTestFixture() @@ -65,3 +66,55 @@ test("trace pcbPath selectors can set thickness", async () => { `${import.meta.path}-selectors-thickness`, ) }) + +test("trace pcbPath selectors with thickness works with KiCad footprints", async () => { + const { circuit } = getTestFixture({ + platform: { + footprintLibraryMap: { + kicad: async () => ({ + footprintCircuitJson: external0402Footprint, + }), + }, + }, + }) + + circuit.add( + + + + + , + ) + + await circuit.renderUntilSettled() + + const pcbTrace = circuit.db.pcb_trace.list()[0] + expect(pcbTrace).toBeDefined() + if (!pcbTrace) throw new Error("Expected trace to be routed") + expect( + pcbTrace.route + .filter((segment) => segment.route_type === "wire") + .every((segment) => segment.width === 0.5), + ).toBe(true) + await expect(circuit).toMatchPcbSnapshot( + `${import.meta.path}-selectors-thickness-kicadd`, + ) +}) From 2f2bfb11ab4169958669e31e9d1d42e518ac0f46 Mon Sep 17 00:00:00 2001 From: techmannih Date: Sat, 25 Oct 2025 03:31:25 +0530 Subject: [PATCH 2/3] f --- .../example29-copper-pour.test.tsx-outline-pcb.snap.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/examples/__snapshots__/example29-copper-pour.test.tsx-outline-pcb.snap.svg b/tests/examples/__snapshots__/example29-copper-pour.test.tsx-outline-pcb.snap.svg index 61e6a338b..3974bd8d0 100644 --- a/tests/examples/__snapshots__/example29-copper-pour.test.tsx-outline-pcb.snap.svg +++ b/tests/examples/__snapshots__/example29-copper-pour.test.tsx-outline-pcb.snap.svg @@ -1 +1 @@ -R1R2 \ No newline at end of file +R1R2 \ No newline at end of file From 5a0976eb9270f4c4ad6e57e7eb6de8a0c5624ead Mon Sep 17 00:00:00 2001 From: techmannih Date: Sat, 25 Oct 2025 03:32:17 +0530 Subject: [PATCH 3/3] f --- .../primitive-components/trace-pcb-path-selectors.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/components/primitive-components/trace-pcb-path-selectors.test.tsx b/tests/components/primitive-components/trace-pcb-path-selectors.test.tsx index 2c40368ca..b21b5ec9e 100644 --- a/tests/components/primitive-components/trace-pcb-path-selectors.test.tsx +++ b/tests/components/primitive-components/trace-pcb-path-selectors.test.tsx @@ -115,6 +115,6 @@ test("trace pcbPath selectors with thickness works with KiCad footprints", async .every((segment) => segment.width === 0.5), ).toBe(true) await expect(circuit).toMatchPcbSnapshot( - `${import.meta.path}-selectors-thickness-kicadd`, + `${import.meta.path}-selectors-thickness-kicad`, ) })