ManageProducts: group by category#2714
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2714 +/- ##
==========================================
+ Coverage 76.74% 76.86% +0.12%
==========================================
Files 301 301
Lines 22257 22222 -35
Branches 2246 2246
==========================================
Hits 17082 17082
+ Misses 5127 5092 -35
Partials 48 48
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot fix the build; then apply the same changes (use category grouping, remove paginating) to StandardProductsContainer |
Agent-Logs-Url: https://github.com/boxwise/boxtribute/sessions/6e388217-ca30-470c-8ae5-a6515f20ee88 Co-authored-by: pylipp <10617122+pylipp@users.noreply.github.com>
Done in commit 4c5e325. Changes made:
The |
There was a problem hiding this comment.
Pull request overview
This PR updates the “Manage Products” views to display products grouped by category, shifting the rendering logic to use react-table’s useGroupBy plugin and adjusting data-fetching for standard products to use Apollo’s suspense API.
Changes:
- Add
useGroupBy+groupBy: ["category"]to both Products and Standard Products tables and render grouped headers with sub-rows. - Remove pagination UI/logic in both tables (switch from
pagetorows). - Switch
StandardProductsContainerfromuseQuerytouseSuspenseQueryand simplify table data memoization.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| front/src/views/Products/components/StandardProductsTable.tsx | Adds category grouping and renders grouped rows; removes pagination path. |
| front/src/views/Products/components/StandardProductsContainer.tsx | Switches to useSuspenseQuery and removes explicit loading/error handling. |
| front/src/views/Products/components/ProductsTable.tsx | Adds category grouping and grouped-row rendering; removes pagination path. |
| front/src/views/Products/components/ProductsContainer.tsx | Makes name sorting more null-safe. |
|
@copilot after the review, implement these changes:
|
…n state, fix build Agent-Logs-Url: https://github.com/boxwise/boxtribute/sessions/76f87288-de7c-4100-bbf2-bc6426bf2743 Co-authored-by: pylipp <10617122+pylipp@users.noreply.github.com>
Done in commit 88d2392:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
front/src/views/Products/components/ProductsTable.tsx:242
- The body renderer returns
nullfor any top-level row that is not a grouped row. If grouping is ever disabled (e.g. via react-table state changes, column config, or future UI), the table will render empty even thoughrowscontains leaf rows. Add a fallback rendering path for non-grouped rows (the same as the previous non-grouped row rendering).
);
}
return null;
})}
front/src/views/Products/components/StandardProductsTable.tsx:194
- The renderer returns
nullfor any top-level row that is not grouped. This will result in an empty table if grouping is ever turned off (now or in a future change), even though leaf rows exist. Add a non-grouped rendering branch (as before) so the table still works without grouping.
);
}
return null;
})}
| const { | ||
| headerGroups, | ||
| prepareRow, | ||
| allColumns, | ||
| state: { globalFilter, pageIndex, filters, sortBy, hiddenColumns }, | ||
| rows, | ||
| state: { globalFilter, filters, sortBy, hiddenColumns }, | ||
| setGlobalFilter, | ||
| setAllFilters, | ||
| page, | ||
| canPreviousPage, | ||
| canNextPage, | ||
| pageOptions, | ||
| nextPage, | ||
| previousPage, | ||
| } = useTable( |
| const { | ||
| headerGroups, | ||
| prepareRow, | ||
| allColumns, | ||
| state: { globalFilter, pageIndex, filters, sortBy, hiddenColumns }, | ||
| rows, | ||
| state: { globalFilter, filters, sortBy, hiddenColumns }, | ||
| setGlobalFilter, | ||
| setAllFilters, | ||
| page, | ||
| canPreviousPage, | ||
| canNextPage, | ||
| pageOptions, | ||
| nextPage, | ||
| previousPage, | ||
| } = useTable( |
https://trello.com/c/ECwkpzcz
https://github.com/copilot/c/94c27cc0-7da8-4eaf-bd40-9848d508897d