Normalize string-valued supplier part numbers during chip inflation#2566
Draft
posthog[bot] wants to merge 1 commit into
Draft
Normalize string-valued supplier part numbers during chip inflation#2566posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
When a source_component's supplier_part_numbers.jlcpcb arrives as a bare string (e.g. "C7484") instead of an array (["C7484"]), the chipProps zod schema rejects it with "Expected array, received string". That error was swallowed during instantiation and swapped for an ErrorPlaceholder, producing a broken "Could not create chip" render. inflateSourceChip now coerces any string-valued supplier part number into a single-element array before handing it to Chip, mirroring the Array.isArray guard already used in the supplier footprint mismatch check, so the render degrades gracefully instead of throwing. Generated-By: PostHog Code Task-Id: b5710550-0905-46f1-ac00-80b6ede2dc7e
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
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.
Summary
A
<chip>inflated from circuit JSON crashes withCould not create chipwhen asource_component'ssupplier_part_numbers.jlcpcbarrives as a bare string (e.g."C7484") instead of an array (["C7484"]). ThechipPropszod schema rejects the string with "Expected array, received string"; that error is swallowed increate-instance-from-react-element.tsand swapped for anErrorPlaceholder, producing a broken render.inflateSourceChipnow coerces any string-valued supplier part number into a single-element array before handing it toChip, mirroring theArray.isArrayguard already used inNormalComponent_doInitialSupplierFootprintMismatchWarning.ts. The render now degrades gracefully instead of throwing.Added a reproduction test under
tests/subcircuits/that inflates a chip whose supplier part number is the malformed bare-string shape and asserts no errors are produced.Why
Affected users hit a repeating broken-chip render because a JLCPCB supplier part number was coming through as a plain string rather than an array, throwing during chip instantiation.
Created with PostHog Code from an inbox report.