Skip to content

Conversation

@adityathebe
Copy link
Member

@adityathebe adityathebe commented Feb 12, 2026

resolves: #2852

Summary by CodeRabbit

  • Bug Fixes
    • Improved audit report table initialization to ensure default pagination, sorting, and display parameters are properly applied on initial load, preventing missing or incorrectly ordered data.

… fetch

The view spec defaults (table.size, table.sort) were applied via useEffect,
which runs after the first render. This caused the initial query to fire with
a hardcoded limit=50 fallback, followed by a second corrected query once the
effect updated the URL params.

Compute effective search params synchronously via useMemo so the very first
query uses the correct limit and sort from the view spec.
@vercel
Copy link

vercel bot commented Feb 12, 2026

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

Project Deployment Actions Updated (UTC)
aws-preview Ready Ready Preview Feb 12, 2026 11:49am
flanksource-ui Ready Ready Preview Feb 12, 2026 11:49am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

Walkthrough

The change introduces an effectiveTableSearchParams memoized helper in the View component that synchronously constructs default display parameters (pageSize, pageIndex, sortBy, sortOrder) from existing parameters and configuration. This helper replaces direct usage of tableSearchParams in the query key and query function to ensure initial table fetches include proper defaults immediately, without relying on useEffect completion.

Changes

Cohort / File(s) Summary
Table Parameter Initialization
src/pages/audit-report/components/View/View.tsx
Added effectiveTableSearchParams memoized helper to synchronously construct default table pagination and sorting parameters; updated query key and query function to use this helper instead of raw tableSearchParams.

Possibly related PRs

  • #2758: Also modifies the View component to ensure table pagination/sorting defaults are applied to initial data queries.
  • #2739: Touches the same file and restructures View component's data-fetch and query parameter handling.

Suggested reviewers

  • moshloop
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main fix: using table display defaults on the first query to avoid a double fetch, which directly addresses the PR's core objective of preventing duplicate queries by applying defaults synchronously instead of in a useEffect.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/view-table-default-page-size

No actionable comments were generated in the recent review. 🎉


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.

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 View - When first opened recent changes paging limit not sent to server

1 participant