Skip to content

feat: templates list pagination#352

Open
drankou wants to merge 11 commits into
mainfrom
template-list-pagination-eng-4207
Open

feat: templates list pagination#352
drankou wants to merge 11 commits into
mainfrom
template-list-pagination-eng-4207

Conversation

@drankou
Copy link
Copy Markdown
Contributor

@drankou drankou commented Jun 2, 2026

Summary

Replaces the full-list getTemplates query with a cursor-paginated endpoint and rewires the templates list UI around useSuspenseInfiniteQuery + a Load More button. Sorting, filtering, and search are now executed server-side, so the page no longer needs to download every template up front and the table is a pure renderer over the rows returned by the paginated query.

Changes

Backend (tRPC + repository)

  • New listTeamTemplates repo method accepting cursor, limit, cpuCount, memoryMB, public, search, and a single sort token; returns { data, nextCursor }.
  • templates.getTemplates router input now validates the same params (limit ≤ 100, default 50; sort defaults to updated_at_desc).
  • Full-list getTeamTemplates is kept untouched — still used by the terminal page.

Sort token

The active react-table column + direction is mapped to one of the server enum values:

Column Asc Desc
name name_asc name_desc
cpuCount cpu_count_asc cpu_count_desc
memoryMB memory_mb_asc memory_mb_desc
createdAt created_at_asc created_at_desc
updatedAt updated_at_asc updated_at_desc

drankou added 5 commits June 2, 2026 17:26
…i spec

Regenerates the dashboard-api client types for the cursor-paginated
GET /templates (single `sort` enum) and GET /templates/{templateID}.
…nput

getTemplates accepts cursor/limit/filter/search and a single `sort` token
and returns a paginated page via the dashboard-api endpoint. The full-list
getTeamTemplates (used by the terminal page) is kept unchanged.
…/filter

Switches the list to useSuspenseInfiniteQuery, flattens pages, auto-loads
the next page on scroll, and maps the active column+direction to the single
server `sort` token (react-table runs in manual mode).
…y change

Replaces the optimistic setQueryData (incompatible with the infinite query
cache) with a pathKey invalidation matching every filter/sort variant.
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 2, 2026

ENG-4207

@cla-bot cla-bot Bot added the cla-signed label Jun 2, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 4, 2026 8:06am
web-juliett Ready Ready Preview, Comment Jun 4, 2026 8:06am

Request Review

@drankou drankou marked this pull request as ready for review June 2, 2026 21:00
@drankou drankou requested a review from ben-fornefeld as a code owner June 2, 2026 21:00
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0fde47cc58

ℹ️ 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".

Comment thread src/features/dashboard/templates/list/table-body.tsx
Comment thread src/features/dashboard/templates/list/table.tsx
Template IDs are random nanoid strings — sorting alphabetically by them
gives no meaningful order. The server-side sort enum has no templateID
variant (clicks would silently fall back to updated_at_desc on the
server), so this just removes the misleading sort affordance from the
column header to match the other unsortable columns
(Visibility, ENVD Ver., Actions).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant