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

Open Beginner friendly
#2,835 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
react, typescript
Domain
frontend, testing

Research direction

Start with the Fuse schematic display-value logic and compare it with Capacitor._getSchematicSymbolDisplayValue(), which handles schShowRatings. Add coverage in tests/components/normal-components/fuse.test.tsx for the explicit false case, then verify that ratings are omitted only when schShowRatings={false} and the existing default remains unchanged.

Written by the indexing model from the issue text.

Description

What happens

schShowRatings is declared on FuseProps but Fuse never reads it, so setting it — in either direction — has no effect:

<fuse name="F1" currentRating="1A" voltageRating="32V" />
<fuse name="F2" currentRating="1A" voltageRating="32V" schShowRatings />
<fuse name="F3" currentRating="1A" voltageRating="32V" schShowRatings={false} />
F1  symbol_display_value  "1A / 32V"
F2  symbol_display_value  "1A / 32V"
F3  symbol_display_value  "1A / 32V"   ← explicitly asked for no ratings

The prop is documented in the schema:

// @tscircuit/props — interface FuseProps
/**
 * Whether to show ratings on schematic
 */
schShowRatings?: boolean;
Compare with capacitor, where it works

Capacitor._getSchematicSymbolDisplayValue() reads it, and the behaviour is visibly different:

C1  capacitance="1uF" maxVoltageRating="16V"                   → "1uF"
C2  capacitance="1uF" maxVoltageRating="16V" schShowRatings     → "1uF/16V"

So the same prop name means something on <capacitor /> and nothing on <fuse />.

One difference worth noting before fixing

The two schemas aren't identical:

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

Capacitor defaults to hiding ratings and shows them on opt-in. Fuse currently always shows them, and with no schema default there's no "intended" default to read off. Making fuse opt-in like capacitor would silently blank the ratings on every existing fuse schematic, so I'd treat that as a separate decision.

The unambiguous part of the bug is that schShowRatings={false} is ignored — the user explicitly asked for no ratings and got them anyway. PR ready that fixes exactly that and leaves the default untouched; happy to follow up with the opt-in alignment if you'd prefer fuse to match capacitor.

Why no test catches it

tests/components/normal-components/fuse.test.tsx never passes schShowRatings at all.

(Related but separate: #2833 / #2834, where a fuse without voltageRating renders "1A / V".)

Dominant language
TypeScript
Stars
58
Forks
203
Avg merge
7h 39m
Merged PRs (30d)
286

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tscircuit/core

All issues in tscircuit/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.