-
Notifications
You must be signed in to change notification settings - Fork 69
[LG-5463] fix(code): fix language select rendering when displayName and language differ #3075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…hing either its display name or language value.
🦋 Changeset detectedLatest commit: ebabcbe The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug in the Code component where the language select wouldn't render when the displayName
and language
properties differed in language options. The fix updates the Panel component's language matching logic to check both properties instead of only displayName
.
- Updates language matching logic in Panel component to check both
displayName
andlanguage
properties - Adds comprehensive test coverage for both matching and differing displayName/language scenarios
- Centralizes language options configuration by moving it to test utilities
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/code/src/Panel/Panel.tsx |
Updated currentLanguage finder to match against both displayName and language properties |
packages/code/src/testing/Code.testutils.tsx |
Added new language option with differing displayName ("macOS") and language ("shell") |
packages/code/src/Code/Code.spec.tsx |
Added comprehensive test cases for both matching and differing displayName/language scenarios |
packages/code/src/LanguageSwitcher/LanguageSwitcherExample.tsx |
Refactored to use centralized language options and added shell snippet support |
packages/code/src/Code.stories.tsx |
Updated import to use centralized language options from test utilities |
packages/code/src/testing/getTestUtils.spec.tsx |
Updated test expectation to account for additional language option |
.changeset/flat-carrots-change.md |
Added changeset documentation explaining the bug fix |
Size Change: +48 B (0%) Total Size: 2.01 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
✍️ Proposed changes
Fixes a bug in the Code component that prevented the language select from rendering when the
displayName
andlanguage
properties differed in the language options. The issue was in the Panel component's logic for finding the current language, which only matched againstdisplayName
but not against thelanguage
property itself.The fix updates the language matching logic to check both
displayName
andlanguage
properties, enabling proper rendering of the language selector in cases where these values differ (e.g., displayName: "macOS", language: "shell").🎟️ Jira ticket: LG-5463
✅ Checklist
pnpm changeset
and documented my changes🧪 How to test changes
Story
View the
With Language Switcher
storyManually
displayName
andlanguage
differ:language
value (not displayName):Code.spec.tsx
to verify the fix works for both matching and differing displayName/language scenarios