feat: templates list pagination#352
Open
drankou wants to merge 11 commits into
Open
Conversation
…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.
|
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: 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".
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the full-list
getTemplatesquery with a cursor-paginated endpoint and rewires the templates list UI arounduseSuspenseInfiniteQuery+ 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)
listTeamTemplatesrepo method acceptingcursor,limit,cpuCount,memoryMB,public,search, and a singlesorttoken; returns{ data, nextCursor }.templates.getTemplatesrouter input now validates the same params (limit ≤ 100, default 50;sortdefaults toupdated_at_desc).getTeamTemplatesis 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:
namename_ascname_desccpuCountcpu_count_asccpu_count_descmemoryMBmemory_mb_ascmemory_mb_desccreatedAtcreated_at_asccreated_at_descupdatedAtupdated_at_ascupdated_at_desc