Update Slider and DataTable pagination handling#411
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR introduces conditional pagination logic to DataTable, ensuring pagination only renders when both enabled and dataset exceeds page size, updates Slider Thumb element key generation for stability, and adjusts test data accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
Pull request overview
This PR updates UI component behavior around pagination in the DataTable and stabilizes Slider thumb rendering, alongside Storybook story/data tweaks to better demonstrate the updated pagination behavior.
Changes:
- Make
DataTablepagination conditional so pagination is only enabled/rendered when the dataset exceeds the configured page size. - Update
Sliderthumb keys to avoid using the thumb value as the React key. - Adjust Table Storybook pagination defaults and sample dataset size.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| libs/react/ui/src/components/table/table.stories.tsx | Updates the pagination story’s default pageSize to better reflect the intended pagination behavior. |
| libs/react/ui/src/components/table/table.stories.data.ts | Reduces story sample data size to align with updated pagination handling and story expectations. |
| libs/react/ui/src/components/table/data-table.tsx | Introduces conditional pagination enabling/rendering based on data length vs. page size. |
| libs/react/ui/src/components/slider/slider.tsx | Uses stable thumb keys based on index instead of thumb value. |
| .changeset/nice-states-share.md | Declares a minor release for the UI package reflecting the behavior changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const isPaginationNeeded = pagination && data.length > pageSize; | ||
|
|
||
| const table = useReactTable({ | ||
| data, | ||
| columns: columnsWithSelection, | ||
| getCoreRowModel: getCoreRowModel(), | ||
| getFilteredRowModel: getFilteredRowModel(), | ||
| getSortedRowModel: getSortedRowModel(), | ||
| getPaginationRowModel: pagination ? getPaginationRowModel() : undefined, | ||
| getPaginationRowModel: isPaginationNeeded ? getPaginationRowModel() : undefined, |
There was a problem hiding this comment.
This change makes pagination conditional on data.length > pageSize, so pagination={true} no longer guarantees paginated behavior or a visible footer. Since pagination is a public prop, consider either (a) updating the component JSDoc/prop contract to reflect the new behavior, or (b) keeping pagination enabled when pagination is true and only conditionally hiding the navigation UI (e.g., when table.getPageCount() <= 1).
Summary by CodeRabbit
Bug Fixes
Chores