Skip to content

fix: reset File Ingest Log pagination when rows per page changes BED-8109#2754

Merged
elikmiller merged 2 commits into
mainfrom
bed-8109-reset-file-ingest-pagination
May 14, 2026
Merged

fix: reset File Ingest Log pagination when rows per page changes BED-8109#2754
elikmiller merged 2 commits into
mainfrom
bed-8109-reset-file-ingest-pagination

Conversation

@elikmiller
Copy link
Copy Markdown
Contributor

@elikmiller elikmiller commented May 7, 2026

Description

FileIngestTable in bh-shared-ui tracks page independently from rowsPerPage. When the user paginates to a non-zero page and then changes Rows per page, the API call keeps the stale skip = rowsPerPage * page value. If the new (skip, limit) window falls past the end of the result set, the table renders empty even though matching jobs exist.

Motivation and Context

Resolves BED-8109

How Has This Been Tested?

  • Added two integration tests under a new pagination reset describe block in
    FileIngestTable.test.tsx

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • Bug Fixes

    • Pagination now resets to the first page when rows-per-page is changed.
    • Applying a status filter resets pagination to the first page and correctly applies the filter.
  • Tests

    • Added tests validating pagination reset when filters are applied and when page size changes.
    • Tests simulate server responses and verify the table displays the expected number of rows after interactions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: ed489701-00dd-421e-81e1-26e4f92ebd2f

📥 Commits

Reviewing files that changed from the base of the PR and between 8156325 and 57989b5.

📒 Files selected for processing (1)
  • packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.test.tsx

📝 Walkthrough

Walkthrough

FileIngestTable component pagination behavior is corrected to reset the current page to 0 when users change the rows-per-page value. Test utilities are updated and comprehensive end-to-end test coverage is added to verify pagination reset occurs both when applying filters and changing page size.

Changes

Pagination Reset Implementation and Testing

Layer / File(s) Summary
Pagination Reset Implementation
packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.tsx
onRowsPerPageChange handler now calls setPage(0) to reset pagination state whenever the rows-per-page value changes.
Pagination Reset Test Coverage
packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.test.tsx
Test utilities expanded to include act/waitFor, and a new pagination reset test suite added with MSW simulating filtered, paginated responses; tests verify skip resets to 0 when applying status filters and when changing rows-per-page, and assert resulting query params and rendered row counts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A table once lost when pages did flow,
Now resets its place when page sizes grow.
With filters applied and limits redone,
The pagination fairy makes sure none are shunned. 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: resetting File Ingest Log pagination when rows per page changes, with the associated ticket reference.
Description check ✅ Passed The description covers the core required sections (Description, Motivation, How Has This Been Tested, Types of changes) but is missing the Checklist section with required verification items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bed-8109-reset-file-ingest-pagination

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.

@elikmiller elikmiller marked this pull request as ready for review May 7, 2026 20:41
Copy link
Copy Markdown
Contributor

@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.

🧹 Nitpick comments (3)
packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.test.tsx (2)

202-204: 💤 Low value

req.url is already a URL instance in MSW v1 — new URL(req.url.toString()) is a redundant round-trip.

MSW v1 exposes req.url as a URL instance whose searchParams property is a URLSearchParams instance, so req.url can be used directly without reconstructing it.

♻️ Optional simplification
-                    const url = new URL(req.url.toString());
+                    const url = req.url;
                     fileUploadRequests.push(url);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.test.tsx`
around lines 202 - 204, The test handler is recreating a URL unnecessarily;
inside the rest.get callback replace the round-trip new URL(req.url.toString())
with the existing req.url (which is already a URL instance in MSW v1) and push
that directly into fileUploadRequests; update the rest.get handler reference to
use req.url and any code that accesses searchParams to use req.url.searchParams
so you don't reconstruct the URL object.

202-204: 💤 Low value

req.url is already a URL instance in MSW v1 — remove the redundant new URL() constructor call.

♻️ Simplification
-                    const url = new URL(req.url.toString());
-                    fileUploadRequests.push(url);
+                    fileUploadRequests.push(req.url);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.test.tsx`
around lines 202 - 204, The test handler in the rest.get callback constructs a
redundant URL with new URL(req.url.toString()); instead use the existing URL
instance on req.url directly—replace the new URL(...) usage with req.url when
pushing to fileUploadRequests in the rest.get handler to avoid unnecessary
conversion and rely on MSW v1's native URL object.
packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.tsx (1)

104-107: 💤 Low value

LGTM — correct and consistent with handleOnConfirm.

Both state updates are batched in React 18+ event handlers, so a single re-render (and single query refetch) will occur. One optional micro-improvement: pass an explicit radix to parseInt.

♻️ Optional: explicit radix
-                                setRowsPerPage(parseInt(event.target.value));
+                                setRowsPerPage(parseInt(event.target.value, 10));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.tsx`
around lines 104 - 107, Update the onRowsPerPageChange handler to use an
explicit radix when parsing the rows-per-page value (e.g., replace
parseInt(event.target.value) with parseInt(event.target.value, 10) or
Number(event.target.value)) so the setRowsPerPage call in the
onRowsPerPageChange callback is unambiguous; this mirrors the parsing approach
used in handleOnConfirm and keeps behavior consistent across locales and
environments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.test.tsx`:
- Around line 202-204: The test handler is recreating a URL unnecessarily;
inside the rest.get callback replace the round-trip new URL(req.url.toString())
with the existing req.url (which is already a URL instance in MSW v1) and push
that directly into fileUploadRequests; update the rest.get handler reference to
use req.url and any code that accesses searchParams to use req.url.searchParams
so you don't reconstruct the URL object.
- Around line 202-204: The test handler in the rest.get callback constructs a
redundant URL with new URL(req.url.toString()); instead use the existing URL
instance on req.url directly—replace the new URL(...) usage with req.url when
pushing to fileUploadRequests in the rest.get handler to avoid unnecessary
conversion and rely on MSW v1's native URL object.

In
`@packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.tsx`:
- Around line 104-107: Update the onRowsPerPageChange handler to use an explicit
radix when parsing the rows-per-page value (e.g., replace
parseInt(event.target.value) with parseInt(event.target.value, 10) or
Number(event.target.value)) so the setRowsPerPage call in the
onRowsPerPageChange callback is unambiguous; this mirrors the parsing approach
used in handleOnConfirm and keeps behavior consistent across locales and
environments.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 414ab48f-0bff-44cd-8d26-9a5f7887e237

📥 Commits

Reviewing files that changed from the base of the PR and between 2f5f915 and 8156325.

📒 Files selected for processing (2)
  • packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.test.tsx
  • packages/javascript/bh-shared-ui/src/components/FileIngestTable/FileIngestTable.tsx

Copy link
Copy Markdown
Contributor

@urangel urangel left a comment

Choose a reason for hiding this comment

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

lgtm 🚀

@elikmiller elikmiller merged commit 8e821e9 into main May 14, 2026
13 of 14 checks passed
@elikmiller elikmiller deleted the bed-8109-reset-file-ingest-pagination branch May 14, 2026 17:11
@github-actions github-actions Bot locked and limited conversation to collaborators May 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants