Skip to content

[9.4] [Synthetics] Stop per-card maintenance-window refetch storm on overview scroll (#289776) - #291103

Merged
kibanamachine merged 1 commit into
elastic:9.4from
kibanamachine:backport/9.4/pr-289776
Sep 15, 2026
Merged

kibanamachine merged 1 commit into
elastic:9.4from
kibanamachine:backport/9.4/pr-289776

Conversation

@kibanamachine

Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.4:

Questions ?

Please refer to the Backport tool documentation

…ew scroll (elastic#289776)

## Summary

`useFetchMaintenanceWindows` had no `staleTime`, so react-query treated
its cached result as stale immediately after every fetch. The hook is
called per monitor card (`MetricItemIcon` -> `useMonitorMWs`) from the
virtualized Synthetics overview grid, so scrolling — which constantly
mounts fresh card instances as new rows come into view — fired a brand
new `GET /internal/synthetics/monitors/maintenance_windows` request for
every card, instead of reusing the one already-cached result.

## Fix

Set `staleTime` to match the hook's existing `refetchInterval` (5
minutes) — the same window during which the data is already known to be
safe to reuse (maintenance windows only take effect on a sync interval,
and the existing `refetchInterval` comment explains why 5 minutes is the
right cadence). This is a one-line change with no behavior change to the
periodic background polling.

## Testing

- Added a unit test (`use_fetch_maintenance_windows.test.ts`) asserting
`staleTime` matches `refetchInterval`; confirmed red (fails without the
fix) / green (passes with it).
- Verified live: on the Synthetics overview page (card view), scrolling
to load new pages of monitors previously fired one `maintenance_windows`
request per newly-mounted card. After the fix, scrolling through
newly-loaded pages triggers zero additional requests.

## Test plan

- [x] Unit test added and passing
- [x] Verified locally in a real browser (network trace before/after)
- [x] `node scripts/eslint --fix` clean
- [x] Scoped type-check clean (`synthetics` project full pass)

(cherry picked from commit e443f81)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Sep 15, 2026
@kibanamachine
kibanamachine enabled auto-merge (squash) September 15, 2026 11:51
@kibanamachine

Copy link
Copy Markdown
Contributor Author

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
synthetics 1.1MB 1.1MB +16.0B

Test Failures

  • [job] [logs] FTR Configs #107 / Cloud Security Posture POST /internal/cloud_security_posture/graph Happy flows Pinning should ignore pinnedIds that do not exist

cc @shahzad31

@kibanamachine
kibanamachine merged commit 554922f into elastic:9.4 Sep 15, 2026
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants