Add category filtering to catalog - #50
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds API-backed category filtering to the storefront catalog (ProductList), keeping the selected category in the URL (categoryId) while filtering and paginating client-side over a larger “small catalog” fetch. It also introduces category typing, tests around URL initialization/reset and failure handling, and adds ADR/context documentation capturing the storefront/domain decisions.
Changes:
- Fetch a larger product catalog once, fetch categories in parallel, and filter/paginate client-side based on URL
categoryId. - Add category/product response typing updates (including nullable/optional
categoryId). - Add Vitest coverage for category chips, URL sync/reset, uncategorized products, and category-fetch failure; add ADR/context docs.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/pages/ProductList.tsx | Adds category chips driven by /categories, URL-backed categoryId, and client-side filtering/pagination over a larger catalog fetch. |
| src/pages/ProductList.test.tsx | New tests for URL initialization/reset, single-select category behavior, uncategorized products, and category fetch failure/toast behavior. |
| src/interfaces/productResponse.ts | Extends product typing with categoryId?: number | null. |
| src/interfaces/index.ts | Re-exports category interface. |
| src/interfaces/category.ts | Adds CategoryResponse typing for /categories. |
| docs/adr/0002-client-side-category-filtering-first.md | Records the client-side-first filtering decision and failure behavior expectations. |
| docs/adr/0001-keep-storefront-customer-facing.md | Captures the “storefront is customer-facing” decision. |
| CONTEXT.md | Adds shared vocabulary/definitions (storefront, category filter, uncategorized product, etc.). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+29
to
+30
| const selectedCategoryId = parseCategoryId(searchParams.get("categoryId")); | ||
|
|
benhalverson
marked this pull request as ready for review
July 7, 2026 06:20
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
categoryIdValidation
pnpm biome check src/pages/ProductList.tsx src/pages/ProductList.test.tsx src/interfaces/category.ts src/interfaces/index.ts src/interfaces/productResponse.tspnpm test -- ProductList.test.tsxpnpm run buildgit diff --checkNotes
pnpm run checkstill reports unrelated pre-existing formatting issues inErrorBoundary.test.tsx,Product.test.tsx,Profile.test.tsx, andwebauthn.test.ts.