fix(Capacitor): format capacitance using formatSiUnit to match Resistor and Inductor#2881
Merged
mohan-bee merged 8 commits intoJul 26, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…r invalid string inputs
… value formatting
imrishabh18
approved these changes
Jul 26, 2026
mohan-bee
approved these changes
Jul 26, 2026
Contributor
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR updates
Capacitor._getSchematicSymbolDisplayValue()to format invalid or unparseable capacitance values usingformatSiUnit(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"orcapacitance="fh"was passed to<capacitor />, it previously rendered the raw unparseable string on the schematic symbol instead ofNaNpF(unlike<resistor />which displaysNaNpΩand<inductor />which displaysNaNpH).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):
After