Skip to content

fix: pcbLayout matchAdapt stacked all PCB components at the origin - #3137

Open
zkasuran wants to merge 1 commit into
tscircuit:mainfrom
zkasuran:fix/pcb-matchadapt-fallback-to-pack
Open

fix: pcbLayout matchAdapt stacked all PCB components at the origin#3137
zkasuran wants to merge 1 commit into
tscircuit:mainfrom
zkasuran:fix/pcb-matchadapt-fallback-to-pack

Conversation

@zkasuran

Copy link
Copy Markdown
Contributor

Closes #3136

What

pcbLayout={{ matchAdapt: true }} (and the top-level matchAdapt prop) is a valid PCB layout config, but there is no PCB match-adapt layout. Group.doInitialPcbLayout() dispatched only grid, pack and flex, so the match-adapt mode fell through and no PCB layout ran. Every component stayed on the group origin and overlapped, while the schematic looked fine. The same board without the prop packs cleanly.

Fix

Dispatch the match-adapt PCB mode to packing, the existing default auto-layout, so the board is laid out. Schematic match-adapt is unchanged. A future real PCB match-adapt can replace the fallback in the same spot.

Test

Adds tests/groups/group-pcb-layout-matchadapt.test.tsx: a board with pcbLayout={{ matchAdapt: true }} and four components. It asserts the four get distinct centers and produce no overlap DRC errors. It also carries a PCB snapshot. With the fix reverted the test fails (one distinct center instead of four).

Verification

  • bun test tests/groups/group-pcb-layout-matchadapt.test.tsx: 1 pass
  • bun test tests/groups tests/features/schematic-match-adapt tests/features/flex: 44 pass, 2 skip, 0 fail
  • bunx tsc --noEmit: clean
  • bunx @biomejs/biome format: clean
  • bun run build and bun run smoke-test:dist: pass

AI assistance (Claude) was used in developing this change. The design, review and verification were done by the author. Verified locally before submitting: bun test on the new test and the groups, schematic-match-adapt and flex suites (44 pass, 2 skip, 0 fail), bunx tsc --noEmit, bunx @biomejs/biome format, bun run build and bun run smoke-test:dist.

doInitialPcbLayout handled grid, pack and flex but not the match-adapt
mode that _getPcbLayoutMode returns for pcbLayout.matchAdapt or matchAdapt.
The mode fell through, so no PCB layout ran and every component stayed on
the group origin and overlapped. Fall back to packing so the board is laid
out. Schematic match-adapt is unchanged.

Adds a regression test with a PCB snapshot.
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview Aug 10, 2026 1:41pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pcbLayout.matchAdapt collapses all PCB components onto the group origin

1 participant