feat: add group filter to product listing and related hooks#71
Open
carlosmfreitas2409 wants to merge 1 commit intouseautumn:mainfrom
Open
feat: add group filter to product listing and related hooks#71carlosmfreitas2409 wants to merge 1 commit intouseautumn:mainfrom
carlosmfreitas2409 wants to merge 1 commit intouseautumn:mainfrom
Conversation
|
@carlosmfreitas2409 is attempting to deploy a commit to the Autumn Team on Vercel. A member of the Team first needs to authorize it. |
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add optional group filter parameter to the product listing endpoint and related React hooks.
PR in Autumn: useautumn/autumn#735
Summary by cubic
Add an optional group filter to product listing to fetch and cache products by group. This helps pricing tables and product lists load only products for a specific group.
Written for commit c04e2b3. Summary will update on new commits.
Greptile Overview
Greptile Summary
This PR adds an optional
groupfilter parameter to the product listing functionality across the entire stack. The changes enable filtering products by group at the API level, backend routes, React client methods, and React hooks.API changes
groupparameter toListProductsParamsin both SDK and client type definitionsgroupfrom URL search parameterslistProductsMethodto build query strings with the new parameterusePricingTable,usePricingTableBase,useProductsBase) to accept and use thegroupparametergroupfor correct cache invalidationConfidence Score: 5/5
Important Files Changed
groupfield toListProductsParamsinterface for filtering products by groupgroupfrom search params and passes it to the product list method in the backend route handlerlistProductsMethodto accept optional params and build query string usingbuildPathWithQueryutilitygroupparam to products.list call and includes it in SWR cache key for correct cache invalidationSequence Diagram
sequenceDiagram participant Client as React Client participant Hook as usePricingTable/useProductsBase participant Method as listProductsMethod participant Backend as Backend Route participant SDK as Autumn SDK Client->>Hook: usePricingTable({ group: "premium" }) Hook->>Method: client.products.list({ group: "premium" }) Method->>Method: buildPathWithQuery("/products", { group: "premium" }) Method->>Backend: GET /products?group=premium Backend->>Backend: Extract group from searchParams Backend->>SDK: autumn.products.list({ customer_id, group }) SDK-->>Backend: { list: Product[] } Backend-->>Method: { list: Product[] } Method-->>Hook: { data: { list: Product[] } } Hook->>Hook: Update SWR cache with key ["pricing-table", "premium", backendUrl] Hook-->>Client: { products: Product[] }(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!