Give the agent the existing pagination component, not a one-off page button row
The PR adds "Prev / 1 2 3 / Next" as a row of buttons and a useState page index. The repo already has a Pagination component that writes the page into the query string, keeps the page size consistent, and includes a comp
The PR adds "Prev / 1 2 3 / Next" as a row of buttons and a useState page index. The repo already has a Pagination component that writes the page into the query string, keeps the page size consistent, and includes a compact mobile variant. Nearby tables use it. The new row uses different labels, does not update the URL, and resets the scroll position in a way the rest of the app does not.
I've started treating a homemade page row as a missed component, not as a lighter pager. Switching the slice of rows is the easy part. Sharable URLs and a consistent page-size control are why the component is there.
Why the one-off pager shows up
A tutorial list example stores page in component state and maps an array of numbers to buttons. The model can write that without finding Pagination. Your component may be named Pager or live under a table kit, which is easy to miss if the prompt only says "add page controls."
You also skip the existing rules about default page size, what happens when the last page disappears, and whether the page belongs in the URL.
A simple pagination policy
- New paged lists and tables use the existing pagination component
- Do not build a button row and a local page index in a feature file
- Keep the existing URL or query pattern, including the page-size key
- A new compact or infinite-scroll variant is a component change, with a story
If the list is a "load more" feed, use the existing infinite-scroll or cursor helper, not a numbered pager that ignores the cursor API.
What to put in the prompt
Use the existing Pagination component for this list.
Do not build a Prev/Next button row or a local page index in this file.
Follow the existing query-string or cursor pattern, including page size.
If this is a load-more feed, use the existing cursor helper instead.
Paste one existing Pagination usage. In review, search the diff for a raw "Prev" / "Next" row, a useState page index, and a paged list that does not update the existing search params.
Reject / send back
Reject
- A feature-level page button row that reimplements Pagination
- Page state that is only in memory when the rest of the app puts it in the URL
- A second pagination library added for one table
- A numbered pager on an API that is already cursor-based
Accept
- A list that uses the existing Pagination component
- A component PR that adds a documented variant and a story
- A feed that stays on the existing cursor or load-more helper
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.