Skip to content

feat(dashboards): add UI pagination to DataTable, fix agent-sessions truncation#1811

Merged
OAGr merged 1 commit intomainfrom
claude/maintain-march-2026
Mar 7, 2026
Merged

feat(dashboards): add UI pagination to DataTable, fix agent-sessions truncation#1811
OAGr merged 1 commit intomainfrom
claude/maintain-march-2026

Conversation

@OAGr
Copy link
Contributor

@OAGr OAGr commented Mar 6, 2026

Summary

  • DataTable pagination: Added reusable Prev/Next pagination controls to the DataTable legacy API (DataTableWithDataProps). Defaults to 100 rows/page; controls only appear when there are 2+ pages. Set pageSize=0 to disable pagination (backwards-compatible for callers that have already paginated server-side).
  • Agent sessions truncation fix: agent-sessions-content.tsx was fetching /api/sessions?limit=500 with a hardcoded ceiling. Replaced with fetchAllPaginated to exhaust all pages, preventing silent truncation when session logs exceed 500 rows.
  • Statements/property-explorer verification: Confirmed both /internal/statements and /internal/property-explorer already correctly paginate through all API results. No truncation.
  • /api/sessions/insights verification: Endpoint uses INSIGHTS_LIMIT = 5000 with an explicit truncation warning in logs. Safe for current data volumes.

Test plan

  • TypeScript: tsc --noEmit — clean, no errors
  • Unit tests: pnpm test — 2675 tests pass
  • Gate: pnpm crux validate gate --fix — passed

Closes #1717

Summary by CodeRabbit

  • New Features
    • Data tables now support pagination with Previous/Next navigation buttons and configurable page sizes (default 100 items per page).
    • Result count displays updated to show current page position (e.g., "10 of 50 results").
    • Pagination automatically resets to page 1 when applying search filters.

…ns truncation

Add reusable pagination controls (Prev/Next, page info) to DataTable legacy
API. Defaults to 100 rows/page; controls only appear when there are multiple
pages. Setting pageSize=0 disables pagination for existing callers that pass
large datasets they've already paginated server-side.

Also fixes agent-sessions-content.tsx: the hardcoded ?limit=500 fetch of
session logs is replaced with fetchAllPaginated, preventing silent truncation
when sessions exceed 500 rows.

Closes #1717

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

Warning

Rate limit exceeded

@OAGr has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 54 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5ad84ef1-528f-4d0a-bdb8-a685a29c4ce8

📥 Commits

Reviewing files that changed from the base of the PR and between b518699 and dacc446.

📒 Files selected for processing (2)
  • apps/web/src/app/internal/agent-sessions/agent-sessions-content.tsx
  • apps/web/src/components/ui/data-table.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/maintain-march-2026

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel
Copy link

vercel bot commented Mar 6, 2026

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

Project Deployment Actions Updated (UTC)
longterm-wiki-agent3 Error Error Mar 6, 2026 7:59pm

@OAGr
Copy link
Contributor Author

OAGr commented Mar 7, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 7, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/src/app/internal/agent-sessions/agent-sessions-content.tsx (1)

44-60: ⚠️ Potential issue | 🟠 Major

Surface paginated enrichment failures instead of dropping them.

If the fetch on Line 45 fails, this still returns ok: true and renders agent sessions without the PR/cost/title enrichment. That makes the dashboard silently partial again, even though the PR objective calls for clear error/partial-data indicators when pagination fails. Please propagate a warning/error state to the UI (DataSourceBanner or an inline notice) instead of swallowing logsResult.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/app/internal/agent-sessions/agent-sessions-content.tsx` around
lines 44 - 60, The current code swallows partial/failed pagination by treating
logsResult as success and silently building logsByBranch; update the
fetch-and-enrich flow to detect incomplete pagination (e.g., a returned flag or
mismatched counts from fetchAllPaginated) and propagate that state into the UI
via an error/warning flag (render a DataSourceBanner or inline notice).
Concretely: after calling fetchAllPaginated<SessionRow> (fetchAllPaginated ->
logsResult), check for an explicit incomplete/partial/failure indicator on
logsResult (or compare expected totals vs received items) and set a local
warning state (e.g., logsFetchWarning) that the component uses to render
DataSourceBanner; still build logsByBranch from available items but ensure the
UI shows the warning when pagination didn't fully succeed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/src/components/ui/data-table.tsx`:
- Around line 47-48: The DataTable prop change made pagination opt-out by
default; restore opt-in behavior by setting pageSize's default to disabled (0 or
undefined) so existing callers without pageSize keep no pagination. Update the
DataTable component's prop default for pageSize (and any related handling inside
the DataTable render logic that reads pageSize) to treat missing value as
0/disabled, and ensure any internal pagination logic (e.g., where pageSize is
used to compute pages) respects 0 as “no pagination.” This keeps legacy callers
unaffected and requires explicit pageSize where pagination is desired.

---

Outside diff comments:
In `@apps/web/src/app/internal/agent-sessions/agent-sessions-content.tsx`:
- Around line 44-60: The current code swallows partial/failed pagination by
treating logsResult as success and silently building logsByBranch; update the
fetch-and-enrich flow to detect incomplete pagination (e.g., a returned flag or
mismatched counts from fetchAllPaginated) and propagate that state into the UI
via an error/warning flag (render a DataSourceBanner or inline notice).
Concretely: after calling fetchAllPaginated<SessionRow> (fetchAllPaginated ->
logsResult), check for an explicit incomplete/partial/failure indicator on
logsResult (or compare expected totals vs received items) and set a local
warning state (e.g., logsFetchWarning) that the component uses to render
DataSourceBanner; still build logsByBranch from available items but ensure the
UI shows the warning when pagination didn't fully succeed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0a8137ed-3552-4165-85d3-7d4aa9c18a68

📥 Commits

Reviewing files that changed from the base of the PR and between b518699 and dacc446.

📒 Files selected for processing (2)
  • apps/web/src/app/internal/agent-sessions/agent-sessions-content.tsx
  • apps/web/src/components/ui/data-table.tsx

Comment on lines +47 to +48
/** Number of rows per page. Defaults to 100. Set to 0 to disable pagination. */
pageSize?: number
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Keep pagination opt-in for the legacy DataTable API.

Defaulting pageSize to 100 changes every existing caller that does not pass this prop. Tables like apps/web/src/app/internal/system-health/open-prs-table.tsx:180-187 and apps/web/src/app/internal/session-insights/insights-table.tsx:72-77 will now paginate after 100 rows without any call-site change, so this is a shared-component regression rather than a targeted dashboard adoption. Prefer keeping the default disabled and passing pageSize explicitly where you want pagination.

[suggested_recommended_refactor]

Proposed change
-  /** Number of rows per page. Defaults to 100. Set to 0 to disable pagination. */
+  /** Number of rows per page. Omit or set to 0 to disable pagination. */
   pageSize?: number
@@
-  pageSize = 100,
+  pageSize = 0,

Also applies to: 176-177

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/components/ui/data-table.tsx` around lines 47 - 48, The
DataTable prop change made pagination opt-out by default; restore opt-in
behavior by setting pageSize's default to disabled (0 or undefined) so existing
callers without pageSize keep no pagination. Update the DataTable component's
prop default for pageSize (and any related handling inside the DataTable render
logic that reads pageSize) to treat missing value as 0/disabled, and ensure any
internal pagination logic (e.g., where pageSize is used to compute pages)
respects 0 as “no pagination.” This keeps legacy callers unaffected and requires
explicit pageSize where pagination is desired.

@OAGr OAGr added claude-working Claude Code is actively working on this and removed claude-working Claude Code is actively working on this labels Mar 7, 2026
@OAGr
Copy link
Contributor Author

OAGr commented Mar 7, 2026

⚠️ PR Overlap Warning

This PR shares 2 file(s) with PR #1822:

  • apps/web/src/app/internal/agent-sessions/agent-sessions-content.tsx
  • apps/web/src/components/ui/data-table.tsx

Coordinate to avoid merge conflicts.

Posted by PR Patrol — informational only.

@OAGr OAGr merged commit dacc446 into main Mar 7, 2026
23 of 24 checks passed
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.

Add UI pagination to internal dashboards using fetchAllPaginated

1 participant