Add Load more pagination to policy store list

What does this MR do and why?

Summary

This change adds pagination to the policy list, allowing users to load policies in batches rather than all at once. The list now fetches 20 policies at a time, and a "Load more" button appears at the bottom when additional policies are available. Clicking it appends the next batch to the existing list without replacing what's already shown.

Key behaviors handled:

  • The main list remains visible and interactive while more policies are loading — only the "Load more" button shows a spinner.
  • If the same policy appears in both pages (due to data shifting between requests), duplicates are automatically removed, keeping the first occurrence.
  • If loading more fails, an error message is shown and stale data is cleared.
  • Retrying after an error resets back to the first page cleanly.

Tests were added to cover all these scenarios for both organization and group contexts.

References

Screenshots or screen recordings

Description UI
Loading more policies

How to set up and validate locally

  1. The policy store list needs to be reachable with the experiment enabled and some policies seeded.
  2. Open /-/security/policy_store. Expect 20 rows and a Load more button. (change manually in code for a smaller number)
  3. Click Load more. Expect more rows to appear, and the button to disappear on the last page.
  4. Stop the Rails server and click Load more. Expect the error alert with a Retry option.

Adversarial review

Verdict: pass with findings. No blocking findings.

Addressed in the second commit:

  • The button is hidden while loading, so retry and load-more cannot race for the same cache entry.
  • Rows are deduped by id, because a page-number cursor over a mutable store can repeat a boundary row.
  • The result hook skips the emission that fetchMore triggers before its promise settles, and pageInfo comes from the fetchMore result.
  • New specs cover retry after load more, a repeated boundary row, and the button being hidden while loading.

Left as follow-ups: the known limits listed above.

MR acceptance checklist

Evaluated against the MR acceptance checklist.

🤖 Generated with Claude Code

Edited by Artur Fedorov

Merge request reports

Loading
Loading