[3.22] Fix filter for boolean attributes#6523
Conversation
Initial fix refcator
🦋 Changeset detectedLatest commit: 742daba The changes in this PR will be included in the next version bump. 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.
Pull request overview
Fixes ConditionalFilter option fetching for boolean attributes by returning static Yes/No options instead of querying attribute choices from the API (port of saleor-dashboard#6522).
Changes:
- Pass attribute
typethroughAttributeQueryVarsBuilderintoAttributeChoicesHandler. - Short-circuit
AttributeChoicesHandler.fetch()forAttributeInputTypeEnum.BOOLEANto returncreateBooleanOptions()without an API call. - Add a unit test asserting no GraphQL query is executed and the static boolean options are returned.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/components/ConditionalFilter/FiltersQueryBuilder/queryVarsBuilders/AttributeQueryVarsBuilder.ts |
Threads attribute type into the default attribute choices handler. |
src/components/ConditionalFilter/FiltersQueryBuilder/queryVarsBuilders/AttributeQueryVarsBuilder.test.ts |
Adds coverage to ensure boolean attributes return static options and skip API calls. |
src/components/ConditionalFilter/API/Handler.ts |
Implements boolean short-circuit in AttributeChoicesHandler using createBooleanOptions(). |
.changeset/purple-glasses-try.md |
Records a patch changeset for the boolean attribute filter fix. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.22 #6523 +/- ##
=======================================
Coverage ? 43.56%
=======================================
Files ? 2585
Lines ? 45029
Branches ? 10592
=======================================
Hits ? 19615
Misses ? 24080
Partials ? 1334 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
port of #6522