feat: Add infinite scroll in the templates list#442
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: b5e6a522ab
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
LGTM — small, standard infinite-scroll addition built on the existing virtualizer and pagination plumbing.
Extended reasoning...
Overview
Single-file change to src/features/dashboard/templates/list/table-body.tsx adding automatic prefetch when the virtualized scroll position is within 8 rows of the end of the loaded list. The component already received hasNextPage, isFetchingNextPage, fetchNextPage, and isRefetching props (previously only wired to a manual LoadMoreButton, which is preserved as a fallback).
Security risks
None. Pure client-side UX change to a list component — no auth, crypto, permissions, or data-boundary handling.
Level of scrutiny
Low. Mechanical, follows the standard @tanstack/react-virtual infinite-scroll pattern: read last virtual item index, fire fetchNextPage() in a useEffect when within a threshold. The guard conditions (hasNextPage && !isFetchingNextPage && !isRefetching) prevent duplicate fetches, and the dependency array is complete.
Other factors
useVirtualRows already returns virtualizer (verified in src/lib/hooks/use-virtual-rows.ts:45), so the destructuring is sound. No bug hunter findings. The fallback LoadMoreButton remains, so even if prefetch misfires the user can still advance pagination manually.
Add infinite scrolling to the templates list. The list should automatically load additional results as the user scrolls.
Scenarios