Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/components/base-components/Renderable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm confused because this should be handled on line 310

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there are incomplete async effects from both the immediately previous phase and the declared dependency phases.
but here we’re checking the declared dependency phases within the subtree before recursing into the child nodes

for (const child of this.children) {
child.runRenderPhaseForChildren(phase)
child.runRenderPhase(phase)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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(
<board width="10mm" height="10mm">
<resistor
name="R1"
resistance="10k"
footprint="kicad:Resistor_SMD/R_0402_1005Metric"
pcbX={-3}
pcbY={0}
/>
<resistor
name="R2"
resistance="10k"
footprint="kicad:Resistor_SMD/R_0402_1005Metric"
pcbX={3}
pcbY={0}
/>
<trace
from=".R1 > .pin2"
to=".R2 > .pin1"
pcbPathRelativeTo=".R1 > .pin2"
pcbPath={["R1.pin2", { x: 0, y: 4 }, "R2.pin1"]}
thickness="0.5mm"
/>
</board>,
)

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`,
)
})
Loading