-
Notifications
You must be signed in to change notification settings - Fork 147
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
fix(template-retail-react-app): product-list refinements #957
Changes from all commits
d72eae0
026123a
1852005
f26ba60
68dfadf
4d0e4bb
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 |
---|---|---|
|
@@ -12,7 +12,11 @@ import PropTypes from 'prop-types' | |
const RadioRefinements = ({filter, toggleFilter, selectedFilters}) => { | ||
return ( | ||
<Box> | ||
<RadioGroup value={selectedFilters}> | ||
<RadioGroup | ||
// The following `false` fallback is required to avoid the radio group | ||
// from switching to "uncontrolled mode" when `selectedFilters` is empty. | ||
value={selectedFilters[0] ?? false} | ||
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. This is the key to fixing item 6 from the points listed in the description. If This could cause issues if a refinement had an option where 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. Nice catch. |
||
> | ||
<Stack spacing={1}> | ||
{filter.values | ||
.filter((refinementValue) => refinementValue.hitCount > 0) | ||
|
@@ -28,7 +32,7 @@ const RadioRefinements = ({filter, toggleFilter, selectedFilters}) => { | |
toggleFilter( | ||
value, | ||
filter.attributeId, | ||
selectedFilters?.includes(value.value), | ||
selectedFilters.includes(value.value), | ||
false | ||
) | ||
} | ||
|
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.
Originally the number values in the query string were not being parsed as numbers and were being treated as strings. Looks like we broke this logic after making the change to parse numbers.
Thanks for catching that. 👍