fix: poll templates list while open#450
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: b2f09f2e36
ℹ️ 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".
| getNextPageParam: (lastPage) => lastPage.nextCursor ?? undefined, | ||
| initialCursor: undefined, | ||
| placeholderData: keepPreviousData, | ||
| refetchInterval: TEMPLATES_REFETCH_INTERVAL_MS, |
There was a problem hiding this comment.
Avoid polling every cached infinite page
When a team has enough templates for table-body.tsx to auto-load multiple pages, this interval makes TanStack's infinite query refetch every cached page every 15 seconds. Because this query has no maxPages cap or reset like the builds table, a user who has scrolled through 20 pages now generates 20 /templates requests per tick just by leaving the tab focused, so the polling cost grows with scroll depth and can hammer the API; consider capping cached pages or polling only the first page/list invalidation.
Useful? React with 👍 / 👎.
Poll templates list while open