fix: dashboard search & pagination, drop content from list - #97
Merged
Conversation
- add ListDocumentsQuerySchema (q, limit, offset) with validation - getDocs now selects only dashboard fields (omits content), applies case-insensitive title filter and take/skip, returns pagination totals - validate GET /document query and update Swagger Fixes #56
- dashboard route debounces title search (300ms) and drives limit/offset pagination via GET /document query - DashboardMain adds search input and prev/next pagination bar driven by server totals; resets offset on search Fixes #56
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.
Fixes #56
Problem
GET /documentreturned every owned+collaborated document with fullcontent(Yjs mirror, unbounded), uncapped. Dashboard fetchedGET /documentwith no query and rendered all docs with client-side sort only — no search, no pagination.Verified in worktree
fix/56-dashboard-search-paginationvia code trace (document.controller.ts:139,document.router.ts:38,dashboard.tsx,dashboard-main.tsx) + node repro script. ServerfindManyhad noselect/take/skip, router had novalidate(), client had no search/pagination.Solution
Server
ListDocumentsQuerySchema(q?1-100 trimmed,limit1-50 default 20,offset>=0 default 0) —server/src/validations/documentParams.schema.tsgetDocsnow usesdocumentListSelect(omitscontent/versionCount), appliestitle contains mode:insensitivewhenq, andtake/skip+ parallelcountforpagination: {limit, offset, totalOwned, totalCollaborated}—server/src/controllers/document.controller.tsvalidate({query: ListDocumentsQuerySchema})onGET /—server/src/routers/document.router.tsGET /documentwith query params and paginated response (additive:{owned, collaborated, pagination}) —server/swagger.yamlClient
GET /document?q&limit&offset, stores totals —client/src/app/routes/app/dashboard.tsxDashboardMainadds search input + prev/next pagination bar derived from server totals —client/src/features/Dashboard/components/DashboardMain/dashboard-main.tsxCommits
fix(server): paginate getDocs, exclude content and add title searchfeat(client): add dashboard search and paginationVerification
pnpm --filter server typecheck✔ (afterprisma generate)pnpm --filter client typecheck✔pnpm lint✔ (both packages)pnpm build✔{owned, collaborated}shape — single-doc test (document.test.ts:60-73) remains compatible; single-doc editor still fetches full body viaGET /document/:idNotes
limit/offsetapplied per bucket with shared offset; totals support proper paging. Cursor/virtualization out of scope as per issue acceptance.