-
Notifications
You must be signed in to change notification settings - Fork 36
feat: Use names instead of id for component dropdown #3955
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,7 @@ const Header = ({ | |
| }) | ||
|
|
||
| const componentNames = componentsData?.components?.map( | ||
| (component) => component?.id | ||
| (component) => component?.name | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Component filter uses names instead of IDs for APIThe change from |
||
| ) | ||
|
|
||
| const value = TimeOptions.find( | ||
|
|
||
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.
Bug: Type mismatch in
MultiSelectcomponent:itemsare strings,selectedItemsOverrideare objects, causingisEqualto fail.Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
The
MultiSelectcomponent receives an array of strings (component?.name) for itsitemsprop, but an array ofComponentobjects ({name, id}) for itsselectedItemsOverrideprop. The internalisItemSelectedfunction useslodash.isEqualto compare these, which returnsfalsewhen comparing a string (e.g., 'Component 1') with an object (e.g.,{name: 'Component 1', id: 'component1'}). This type mismatch prevents correct item selection matching, causing all dropdown items to appear as unselected, leading to visual duplicates and a broken selection UI. A related test inHeader.test.tsxwill also fail as it expects to find the component'sid.💡 Suggested Fix
Ensure the
itemsprop passed toMultiSelectis an array ofComponentobjects ({name, id}) to match the type ofselectedItemsOverrideand theonChangehandler's expected input. This can be achieved by mappingcomponentNamesto the fullComponentobjects instead of just theirnameproperty.🤖 Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID:
3339232