-
Notifications
You must be signed in to change notification settings - Fork 2
Add Support For Single Type Facets #206
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
This comment has been minimized.
This comment has been minimized.
From Claude: The reviewer is mistaken. Here's the explanation: This is not a bug. The original code works correctly because selectedOptionMap is read before any mutation Let's trace through the execution when clicking an already-selected option (e.g., "small" is selected): const onOptionSelect = (optionValue: string) => { State before click: selectedOptionMap = { small: true } Step-by-step execution:
Result: The option is correctly deselected. Why the reviewer's concern is incorrect: The reviewer suggested that reading selectedOptionMap[optionValue] after clearing the map would cause issues. In JavaScript, const newMap = {} creates a completely separate object. Reading selectedOptionMap[optionValue] on |
esezen
left a comment
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.
This is looking good overall. I requested one change. Thank you!
|
|
||
| export interface UseFilterOptionsListProps { | ||
| multipleFacet: PlpMultipleFacet; | ||
| multipleFacet: PlpMultipleFacet | PlpSingleFacet; |
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.
This is a bit confusing. Can we please rename the prop from multipleFacet to something else? We would have to keep backwards compatibility but we can at least use the new name in our implementation to make it easier to maintain
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.
@esezen I've renamed the prop to "facet" and left in backwards compatibility incase "multipleFacet" is still passed
This comment has been minimized.
This comment has been minimized.
Code Review Results✅ StrengthsWell-structured implementation with comprehensive test coverage for single facet selection behavior and backward compatibility for the deprecated prop. 🚨 Critical IssuesNone
|
Pull Request Checklist
Before you submit a pull request, please make sure you have to following:
PR Type
What kind of change does this PR introduce?