Skip to content

Fix async matching for repeated footprint pads - #3352

Merged
seveibar merged 1 commit into
mainfrom
fix/repeated-footprint-pad-ports
Aug 20, 2026
Merged

Fix async matching for repeated footprint pads#3352
seveibar merged 1 commit into
mainfrom
fix/repeated-footprint-pad-ports

Conversation

@seveibar

Copy link
Copy Markdown
Contributor

Summary

  • invalidate selector caches immediately when the component tree changes
  • let async footprint pads see ports inferred during the same render cycle
  • rebuild source_component_internal_connection records when async port initialization dirties source attachment
  • add an async kicad:-style regression for a four-pad switch with pad numbers 1, 1, 2, 2

Why

When a library footprint loaded asynchronously, the component's cached selectAll("port") result could still contain only the two primary switch ports. The footprint correctly inferred two additional physical ports for the separated duplicate-numbered pads, but pad matching read the stale cache and attached both pad 1 instances to the primary pin 1 (and likewise for pin 2). PcbPortRender then treated each primary port as ambiguous and emitted no PCB ports.

Invalidating selector caches at the tree mutation boundary makes the newly added ports visible before PortMatching. Updating source-parent attachment also records the inferred physical ports as internally connected after the async load.

The regression verifies that all four pads receive unique PCB ports and that the two repeated-number pairs produce two internal connections.

Related draft safeguards:

Test plan

  • bun test tests/footprint/footprint-library-repeated-pad-numbers.test.tsx
  • bunx tsc --noEmit
  • bun run build
  • full bun test suite started locally; the new regression and surrounding footprint tests pass

@vercel

vercel Bot commented Aug 20, 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 20, 2026 11:26pm

Request Review

@seveibar
seveibar marked this pull request as ready for review August 20, 2026 23:42
@seveibar
seveibar merged commit 22e4ae8 into main Aug 20, 2026
16 checks passed
@seveibar
seveibar deleted the fix/repeated-footprint-pad-ports branch August 20, 2026 23:42
@tscircuitbot

Copy link
Copy Markdown
Contributor

Thank you for your contribution! 🎉

PR Rating: ⭐⭐
Impact: Minor

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


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.

2 participants