Skip to content

fix: prevent duplicate net labels when multiple ports share same net#2159

Open
BossChaos wants to merge 1 commit intotscircuit:mainfrom
BossChaos:fix-repro61-duplicate-net-labels
Open

fix: prevent duplicate net labels when multiple ports share same net#2159
BossChaos wants to merge 1 commit intotscircuit:mainfrom
BossChaos:fix-repro61-duplicate-net-labels

Conversation

@BossChaos
Copy link
Copy Markdown

Fixes repro61 test case where duplicate net labels were shown when multiple components share the same net (GND/VCC).

Problem

When two capacitors C1 and C2 both connect to GND and VCC nets, the schematic renderer placed a net label at each connection point, resulting in duplicate labels (2x GND, 2x VCC).

Solution

Add a netsWithLabels Set to track which nets already have a label placed. When processing ports or traces, skip placing a label if that net already has one.

Changes

  • insertNetLabelsForPortsMissingTrace.ts: Add netsWithLabels tracking
  • insertNetLabelsForTracesExcludedFromRouting.ts: Add netsWithLabels tracking

Test

Repro61 test case now shows only 2 labels (1x GND, 1x VCC) instead of 4.

- Add netsWithLabels tracking Set to avoid placing multiple labels for the same net
- When multiple ports are connected to GND/VCC, only place one label instead of one per port
- Fixes repro61 test case where C1 and C2 both connected to same nets showed duplicate labels
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

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

Project Deployment Actions Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview, Comment Apr 20, 2026 3:58pm

Request Review

Copy link
Copy Markdown
Contributor

@rushabhcodes rushabhcodes left a comment

Choose a reason for hiding this comment

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

proof that this fixes it, iirc this should be fixed in the schematic-trace-solver

@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

@BossChaos
Copy link
Copy Markdown
Author

Just checking in — is there anything else needed from my side to move this forward? Happy to make any adjustments! 👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants