fleet/frontend/components/PaginatedList
Scott Gress b35e65455e
Refactor paginated list to use UseQuery (#33669)
# Details

As mentioned in a previous front-end sync, I realized after having to
add a `reload()` method to the `PaginatedList` imperative handle that I
had strayed too far from the path. The original concept for this
component was for it to be fully self-contained, so the parent didn't
have to concern itself with pagination at all other than being told what
page to load. But the addition of an `onChangePage` property isn't a
tragedy and is totally worth the reduction in code, consistency with use
of `useQuery` elsewhere and React best practice of passing data from
parent to child.

This refactor still retains the use of the imperative handle for
querying the "dirty state" of the list, so parents don't have to manage
that state themselves.

## Testing

- [X] Added/updated automated tests
Updated PaginatedList tests as needed. Also confirmed that tests for the
upstream components (PoliciesPaginatedList, Secrets, RunBatchScriptModal
and ScriptBatchProgress) all passed without any modification.
- [X] QA'd all new/changed functionality manually
Added enough data to paginate each of the components that uses
PaginatedList, confirmed pagination still works and dirty state
functionality (in PoliciesPaginatedList) still works. Also confirmed
add/delete functionality works as expected in Secrets.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- New Features
- Consistent, responsive pagination across Scripts, Secrets, Hosts, and
Policies pages with clearer loading and empty states.
- Bug Fixes
- Delete Secret modal now reliably displays errors and refreshes the
list after deletion.
- Refactor
- Unified data-driven pagination flow for improved performance and
smoother navigation.
  - Simplified list interactions by removing manual reloads.
- Tests
- Updated tests to align with the new pagination behavior and data flow.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-28 11:27:05 -05:00
..
_styles.scss Fleet UI [Feature]: UI reskin (#33558) 2025-09-29 12:10:41 -05:00
index.ts Add pagination to manage automations (#26414) 2025-02-27 12:43:38 -06:00
PaginatedList.tests.tsx Refactor paginated list to use UseQuery (#33669) 2025-10-28 11:27:05 -05:00
PaginatedList.tsx Refactor paginated list to use UseQuery (#33669) 2025-10-28 11:27:05 -05:00