Skip to content

fix(Capacitor): format capacitance using formatSiUnit to match Resistor and Inductor#2881

Merged
mohan-bee merged 8 commits into
tscircuit:mainfrom
KrishnaX12:fix/capacitor-display-value-format
Jul 26, 2026
Merged

fix(Capacitor): format capacitance using formatSiUnit to match Resistor and Inductor#2881
mohan-bee merged 8 commits into
tscircuit:mainfrom
KrishnaX12:fix/capacitor-display-value-format

Conversation

@KrishnaX12

@KrishnaX12 KrishnaX12 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Description

This PR updates Capacitor._getSchematicSymbolDisplayValue() to format invalid or unparseable capacitance values using formatSiUnit(this._parsedProps.capacitance) + "F", aligning its error display behavior with <resistor /> (Resistor.ts) and <inductor /> (Inductor.ts). Valid string expressions (e.g., "10uF", "100nF") continue to be preserved as written to prevent unnecessary diffs in existing schematic renderings.

Issue Fixed

When an invalid or non-numeric string value such as capacitance="lijF" or capacitance="fh" was passed to <capacitor />, it previously rendered the raw unparseable string on the schematic symbol instead of NaNpF (unlike <resistor /> which displays NaNpΩ and <inductor /> which displays NaNpH).

With this change, all passive components now uniformly display standard NaNp... formatting (NaNpΩ, NaNpH, NaNpF) when given invalid input strings.

Verification & Screenshots

Tested locally via terminal symbol rendering and automated unit tests (tests/components/normal-components/capacitor-display-value.test.tsx).

Before (Without Fix):

area_2026-07-26_19-56-41

After

area_2026-07-26_19-55-06

@vercel

vercel Bot commented Jul 26, 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 26, 2026 1:25pm

Request Review

@mohan-bee
mohan-bee merged commit e383398 into tscircuit:main Jul 26, 2026
12 checks passed
@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.

5 participants