refactor: Pagination in DataTable - #821
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55161e96e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const t = useTranslations("core.global"); | ||
| const { isPending, navigate, searchParams } = useDataTableUrl(); | ||
| const pageSize = readTablePageSize(searchParams); | ||
| const page = currentPage ?? readTablePage(searchParams); |
There was a problem hiding this comment.
Preserve cursor navigation when currentPage is null
When a table is reached through a supported cursor URL, withPagination returns currentPage: null, but this fallback treats that cursor page as page 1. Consequently the displayed range is wrong, Previous removes the cursor and jumps to the first page, and Next navigates to numbered page 2 regardless of the cursor's actual position. Retain cursor-based controls whenever currentPage is null, or normalize cursor requests before rendering this pager.
Useful? React with 👍 / 👎.
| <TableRow | ||
| className={rowOpens ? "cursor-pointer" : undefined} | ||
| key={row.id} | ||
| onClick={ | ||
| rowOpens |
There was a problem hiding this comment.
Make clickable table rows keyboard-operable
When rowOpens is supplied, the row is activated only through onClick; a <tr> is not keyboard-focusable and there is no Enter/Space handler, so keyboard-only users cannot perform the row's primary action. Provide an equivalent semantic, focusable keyboard interaction rather than exposing a mouse-only action.
AGENTS.md reference: AGENTS.md:L55-L56
Useful? React with 👍 / 👎.
Improving Documentation
pnpm lint:fixto fix formatting issues before opening the PR.Description
What?
Why?