Skip to content

fix: honour schShowRatings={false} on fuse (#2835)#2836

Open
DPS0340 wants to merge 1 commit into
tscircuit:mainfrom
DPS0340:fix/fuse-sch-show-ratings
Open

fix: honour schShowRatings={false} on fuse (#2835)#2836
DPS0340 wants to merge 1 commit into
tscircuit:mainfrom
DPS0340:fix/fuse-sch-show-ratings

Conversation

@DPS0340

@DPS0340 DPS0340 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Closes #2835.

schShowRatings is declared on FuseProps ("Whether to show ratings on schematic") but Fuse never read it, so schShowRatings={false} rendered the ratings anyway.

                                              before      after
F1  (prop omitted)                            "1A / 32V"  "1A / 32V"   unchanged
F2  schShowRatings                            "1A / 32V"  "1A / 32V"   unchanged
F3  schShowRatings={false}                    "1A / 32V"  undefined    fixed

Deliberately narrow, and here's why

The obvious "fix" would be to mirror Capacitor, which shows ratings only on opt-in. I checked the schemas before assuming they're equivalent, and they aren't:

capacitor:  schShowRatings: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>   ← has a default
fuse:       schShowRatings: z.ZodOptional<z.ZodBoolean>                 ← no default

Capacitor's default is part of its schema; fuse has no default to read off, and it has always shown ratings unconditionally. Switching fuse to opt-in would silently blank the ratings on every existing fuse schematic — a behaviour change dressed up as a bug fix. So this PR only makes the explicit false work:

if (this._parsedProps.schShowRatings === false) return undefined

undefined (prop omitted) and true both keep today's output byte-for-byte. If you'd rather fuse match capacitor's opt-in default, I'm happy to send that as a follow-up — it's a product decision, not a defect, and it deserves its own review.

Verification

The test bites. Reverting only Fuse.ts:

expect(symbolValueByName.F3).toBeUndefined()
Received: "1A / 32V"
(fail) <fuse /> honours schShowRatings={false}

It asserts all three states in one board, so a regression in either direction — breaking the default or failing to suppress — is caught.

Suite: 1260 pass / 0 fail, and no snapshots changed, which is the evidence that the default path is untouched. biome format and tsc --noEmit clean.

Relationship to #2834

Independent — that one fixes the "1A / V" bare-unit output when voltageRating is omitted; this one fixes the ignored prop. They touch the same method, so whichever lands first will need a trivial rebase of the other. Happy to combine them into one PR if you'd prefer a single review.

@vercel

vercel Bot commented Jul 25, 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, Comment Jul 25, 2026 5:10pm

Request Review

@DPS0340

DPS0340 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Housekeeping — rebased onto current main (d99c99f), still 1260 pass / 0 fail. No behaviour change.

Since I have several PRs open here now, a note on how they interact so none of this lands on you:

Five of the seven are fully independent — they touch different files and merge in any order:

PR file
#2838 Inductor.ts
#2844 Hole.ts, PlatedHole.ts
#2846 Group/Group.ts (group insert sites)
#2840 Group/Group.ts (pcb_trace segment insert)
#2842 NormalComponent.ts, Group/Group.ts, Group_doInitialPcbComponentAnchorAlignment.ts

Two pairs conflict, and both are trivial:

  1. fix: omit the voltage half of the fuse label when voltageRating is absent (#2833) #2834fix: honour schShowRatings={false} on fuse (#2835) #2836 — both edit Fuse._getSchematicSymbolDisplayValue(). Whichever merges first, the other needs the two guards stacked:

    if (this._parsedProps.schShowRatings === false) return undefined   // #2836
    if (voltage === undefined || Number.isNaN(voltage)) return currentDisplay  // #2834
    return `${currentDisplay} / ${formatSiUnit(voltage)}V`

    They're orthogonal (one suppresses the whole label, the other drops just the voltage half), so the combined behaviour is well-defined. Both test files also touch fuse.test.tsx, appending separate tests.

  2. fix: carry net highlightColor into pcb_trace.highlight_color (#2839) #2840fix: write display_offset_x/y as display strings (#2841) #2842 — both add a field to nearby inserts in Group.ts; the resolution is to keep both lines.

Happy to do the merge myself: say the word and I'll combine any subset into a single PR, or rebase the losers as soon as the first one lands. I'd rather you not spend time on conflict resolution for my changes.

I verified the above rather than assuming it — checked all 21 branch pairs for conflicts and confirmed each rebases cleanly onto d99c99f.

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.

fuse ignores schShowRatings: schShowRatings={false} still renders the ratings

1 participant