Fix jlcpcb CAD fallback for library footprints#2305
Open
techmannih wants to merge 5 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
seveibar
reviewed
May 17, 2026
Contributor
seveibar
left a comment
There was a problem hiding this comment.
bad naming, the fix is valid but there are issues:
canUseFootprintStringFallbackis unclear. There is no fallback. Better naming is needed e.g.footprintIsFootprinterStringis more clear- Ternary usage is confusing
!!is never allowed
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.
What changed
This updates CAD fallback generation for library-style footprints so
cad_component.footprinter_stringis only emitted for direct footprinter strings such as0402orsoic8.For library references like
jlcpcb:C51950748, KiCad library refs, URLs, and static asset paths, the fallback now emits a bounding-box CAD component instead of forwarding the library reference as a footprinter string.Why this changed
The 3D viewer was trying to parse
jlcpcb:...as a raw footprinter function when no CAD model was available. That produced runtime errors like:Invalid footprint function, got "jlcpcb"The underlying footprint could still load for PCB rendering, but the CAD fallback path was sending an invalid string into the 3D engine.
Impact
This fixes 3D rendering for library footprints that do not provide a CAD model by falling back cleanly to a bounding box instead of surfacing a parser error.
Root cause
NormalComponent.doInitialCadModelRender()treated any string footprint as a validfootprinter_stringfallback. Library refs such asjlcpcb:...are valid footprint lookup keys, but they are not valid raw footprinter expressions.Validation
bun test tests/footprint/footprint-library-map-jlcpcb-cadmodel.test.tsxbun test tests/components/normal-components/cad-component-bounding-box.test.tsxNotes
Repo-wide build/type generation still has unrelated pre-existing DTS failures in
lib/components/primitive-components/PcbTrace.ts.