Unexpected and intermittent reloads of the `policies` and `users` table/page
Fleet versions 4.85.0 / 4.87.1 / dogfood: 4.89.0-rc
- Discovered:
4.87.1 - Reproduced:
4.85.0/4.87.1/4.89.0-rc.2606302019
Web browser and operating system: Google Chrome 149.x / Firefox 152.0.3 // macOS / Ubuntu GNOME
π₯ Β Actual behavior
On the /policies and /users page, the table appears to reload itself intermittently, and when selecting outside the browser window and returning. This causes issues when selecting multiple items.
π οΈ Expected behavior
The table should not randomly reload, forcing the user to re-select items, or be returned to the first page of results.
π§βπ» Β Steps to reproduce
These steps:
- [x] Have been confirmed to consistently lead to reproduction in multiple Fleet instances.
- Browse to
/policiesor/users - Attempt to select multiple items
- Click outside the browser window, and then click back a few seconds later
- Can also happen during selection.
π―οΈ More info (optional)
- Doesn't happen with
/hostsor/reports - See Slack thread for extra screen recordings with the network developer tools visible for policies
- See Slack thread for screen recordings for users
https://github.com/user-attachments/assets/dd28e7b4-305e-4a32-af12-b012666a7862
-
Updated this issue as the same behaviour is present on users
-
@rachaelshaw let me know if you'd prefer it to be separate
-
Discovered in 4.85.0. Added released bug label
@GrayW Opened #48742 for this. It fixes the table losing focus on Policies and Users page
Hi @rrahul-1, thank you for the contribution. We'll get that reviewed as soon as we can.
Validation: #48542 β Intermittent reloads of /policies and /users tables
Verdict: β
CONFIRMED FIXED β code review + live API checks + manual test plan all pass
Instance: https://localhost:8080 β v4.90.0-rc.2607232113 (branch rc-minor-fleet-v4.90.0)
Fix: PR #48742 (rrahul-1), commit 9f8caea025, merged 2026-07-13, on the RC branch
1. Code review β
Root cause: production QueryClient (new QueryClient(), no defaults) β queries inherit
React Query's refetchOnWindowFocus: true. On window refocus the list refetched, tripping
react-table's autoResetSelectedRows/autoResetPage β selection lost / page reset.
| Check | Result |
|---|---|
| Fix on RC branch | β
9f8caea025 ancestor of HEAD |
refetchOnWindowFocus:false on all policies useQuery calls |
β 6 calls / 6 flagged |
| Same on users table | β 2 calls / 2 flagged (users + invites) |
| Changes file | β present |
Finding (non-blocking): fix is tactical, not root-cause β router/index.tsx:128 is still
new QueryClient() with no defaults; the DEFAULT_USE_QUERY_OPTIONS constant
(refetchOnWindowFocus:false) is not applied globally. Other tables relying on the default
stay latently exposed. Reasonable low-risk choice; worth a follow-up to set the QueryClient default.
2. Live API checks β (Bearer auth, admin [email protected])
| Endpoint | Result |
|---|---|
GET /api/latest/fleet/me |
200 β admin |
GET /api/latest/fleet/policies |
200 |
GET /api/latest/fleet/policies/count |
200 |
GET /api/latest/fleet/users |
200 β 7 users |
3. Manual test plan β (headless Chrome via Playwright β cert-ignored, token injected as __Host-token cookie)
Repro: load page β select rows β blur/refocus window β table must not reload/lose selection.
Positive control on BOTH pages: a window focus/visibilitychange listener I registered fired
(focus:1, vis:1) and its control fetch to /fleet/version appeared post-focus β proving the
events reached window listeners (the exact mechanism React Query v3 uses).
| Step | Policies | Users |
|---|---|---|
| Authenticated & table rendered | β | β |
| Focus events delivered (positive control) | β focus+vis, control fetch seen | β focus+vis, control fetch seen |
Only non-list (/version control) fired post-focus |
β | β |
| Row selection preserved after focus | β | n/a (no row selection in table) |
Interpretation: the focus events demonstrably fired (control fetch fired), yet the policies/users
list queries did NOT refetch and the policies row selection survived β i.e. the queries correctly
opted out via refetchOnWindowFocus:false. Pre-fix, the list would have refetched and cleared selection.
Table reloads cease, Seamless, like a calm, glass sea. Fleet's path becomes peace.