-
Notifications
You must be signed in to change notification settings - Fork 6
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: Fix filtering by categories and collections #136
fix: Fix filtering by categories and collections #136
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -0,0 +1,38 @@ | |||
query SearchProductByCategoryQuery( |
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.
check this section https://graphql.org/learn/queries/#directives and extend SearchProductQuery depending on the query's argument named e.g. $searchBy = "category" | "collection" | undefined
to create the query response fields dynamically. With that, you can have a single search query with many outputs depending on the URL search param instead of now 3 and having multiple if conditions in your render function. And check if you can reuse GraphQL Fragments because you've repeated in each new query the products query when it should be reused as a Fragment (stored ready-to-use Products Query).
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.
almost done
I want to merge this change because it fixes filtering by categories and collections while ensuring backward compatibility with existing attribute filtering.
Pull Request Checklist