Skip to content

fix: dashboard search & pagination, drop content from list - #97

Merged
Alimedhat000 merged 2 commits into
mainfrom
fix/56-dashboard-search-pagination
Aug 29, 2026
Merged

fix: dashboard search & pagination, drop content from list#97
Alimedhat000 merged 2 commits into
mainfrom
fix/56-dashboard-search-pagination

Conversation

@Alimedhat000

Copy link
Copy Markdown
Owner

Fixes #56

Problem

GET /document returned every owned+collaborated document with full content (Yjs mirror, unbounded), uncapped. Dashboard fetched GET /document with no query and rendered all docs with client-side sort only — no search, no pagination.

Verified in worktree fix/56-dashboard-search-pagination via code trace (document.controller.ts:139, document.router.ts:38, dashboard.tsx, dashboard-main.tsx) + node repro script. Server findMany had no select/take/skip, router had no validate(), client had no search/pagination.

Solution

Server

  • add ListDocumentsQuerySchema (q? 1-100 trimmed, limit 1-50 default 20, offset >=0 default 0) — server/src/validations/documentParams.schema.ts
  • getDocs now uses documentListSelect (omits content/versionCount), applies title contains mode:insensitive when q, and take/skip + parallel count for pagination: {limit, offset, totalOwned, totalCollaborated}server/src/controllers/document.controller.ts
  • wire validate({query: ListDocumentsQuerySchema}) on GET /server/src/routers/document.router.ts
  • update Swagger GET /document with query params and paginated response (additive: {owned, collaborated, pagination}) — server/swagger.yaml

Client

  • dashboard route debounces search 300ms, resets offset on search, fetches GET /document?q&limit&offset, stores totals — client/src/app/routes/app/dashboard.tsx
  • DashboardMain adds search input + prev/next pagination bar derived from server totals — client/src/features/Dashboard/components/DashboardMain/dashboard-main.tsx

Commits

  1. fix(server): paginate getDocs, exclude content and add title search
  2. feat(client): add dashboard search and pagination

Verification

  • pnpm --filter server typecheck ✔ (after prisma generate)
  • pnpm --filter client typecheck
  • pnpm lint ✔ (both packages)
  • pnpm build
  • additive response keeps existing {owned, collaborated} shape — single-doc test (document.test.ts:60-73) remains compatible; single-doc editor still fetches full body via GET /document/:id

Notes

  • pagination is limit/offset applied per bucket with shared offset; totals support proper paging. Cursor/virtualization out of scope as per issue acceptance.

- 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
@Alimedhat000
Alimedhat000 merged commit a00ea99 into main Aug 29, 2026
2 checks passed
@Alimedhat000
Alimedhat000 deleted the fix/56-dashboard-search-pagination branch August 29, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard lacks search and pagination; getDocs returns full rows unpaginated

1 participant