Commit 554922f
# Backport
This will backport the following commits from `main` to `9.4`:
- [[Synthetics] Stop per-card maintenance-window refetch storm on
overview scroll
(#289776)](#289776)
<!--- Backport version: 9.6.6 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)
<!--BACKPORT
[{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2026-09-15T11:41:29Z","message":"[Synthetics]
Stop per-card maintenance-window refetch storm on overview scroll
(#289776)\n\n## Summary\n\n`useFetchMaintenanceWindows` had no
`staleTime`, so react-query treated\nits cached result as stale
immediately after every fetch. The hook is\ncalled per monitor card
(`MetricItemIcon` -> `useMonitorMWs`) from the\nvirtualized Synthetics
overview grid, so scrolling — which constantly\nmounts fresh card
instances as new rows come into view — fired a brand\nnew `GET
/internal/synthetics/monitors/maintenance_windows` request for\nevery
card, instead of reusing the one already-cached result.\n\n## Fix\n\nSet
`staleTime` to match the hook's existing `refetchInterval` (5\nminutes)
— the same window during which the data is already known to be\nsafe to
reuse (maintenance windows only take effect on a sync interval,\nand the
existing `refetchInterval` comment explains why 5 minutes is the\nright
cadence). This is a one-line change with no behavior change to
the\nperiodic background polling.\n\n## Testing\n\n- Added a unit test
(`use_fetch_maintenance_windows.test.ts`) asserting\n`staleTime` matches
`refetchInterval`; confirmed red (fails without the\nfix) / green
(passes with it).\n- Verified live: on the Synthetics overview page
(card view), scrolling\nto load new pages of monitors previously fired
one `maintenance_windows`\nrequest per newly-mounted card. After the
fix, scrolling through\nnewly-loaded pages triggers zero additional
requests.\n\n## Test plan\n\n- [x] Unit test added and passing\n- [x]
Verified locally in a real browser (network trace before/after)\n- [x]
`node scripts/eslint --fix` clean\n- [x] Scoped type-check clean
(`synthetics` project full
pass)","sha":"e443f816d1018d365c92bd7a6138be218bde19a9","branchLabelMapping":{"^v9.6.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","author:actionable-obs","v9.6.0"],"title":"[Synthetics]
Stop per-card maintenance-window refetch storm on overview
scroll","number":289776,"url":"https://github.com/elastic/kibana/pull/289776","mergeCommit":{"message":"[Synthetics]
Stop per-card maintenance-window refetch storm on overview scroll
(#289776)\n\n## Summary\n\n`useFetchMaintenanceWindows` had no
`staleTime`, so react-query treated\nits cached result as stale
immediately after every fetch. The hook is\ncalled per monitor card
(`MetricItemIcon` -> `useMonitorMWs`) from the\nvirtualized Synthetics
overview grid, so scrolling — which constantly\nmounts fresh card
instances as new rows come into view — fired a brand\nnew `GET
/internal/synthetics/monitors/maintenance_windows` request for\nevery
card, instead of reusing the one already-cached result.\n\n## Fix\n\nSet
`staleTime` to match the hook's existing `refetchInterval` (5\nminutes)
— the same window during which the data is already known to be\nsafe to
reuse (maintenance windows only take effect on a sync interval,\nand the
existing `refetchInterval` comment explains why 5 minutes is the\nright
cadence). This is a one-line change with no behavior change to
the\nperiodic background polling.\n\n## Testing\n\n- Added a unit test
(`use_fetch_maintenance_windows.test.ts`) asserting\n`staleTime` matches
`refetchInterval`; confirmed red (fails without the\nfix) / green
(passes with it).\n- Verified live: on the Synthetics overview page
(card view), scrolling\nto load new pages of monitors previously fired
one `maintenance_windows`\nrequest per newly-mounted card. After the
fix, scrolling through\nnewly-loaded pages triggers zero additional
requests.\n\n## Test plan\n\n- [x] Unit test added and passing\n- [x]
Verified locally in a real browser (network trace before/after)\n- [x]
`node scripts/eslint --fix` clean\n- [x] Scoped type-check clean
(`synthetics` project full
pass)","sha":"e443f816d1018d365c92bd7a6138be218bde19a9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.6.0","branchLabelMappingKey":"^v9.6.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/289776","number":289776,"mergeCommit":{"message":"[Synthetics]
Stop per-card maintenance-window refetch storm on overview scroll
(#289776)\n\n## Summary\n\n`useFetchMaintenanceWindows` had no
`staleTime`, so react-query treated\nits cached result as stale
immediately after every fetch. The hook is\ncalled per monitor card
(`MetricItemIcon` -> `useMonitorMWs`) from the\nvirtualized Synthetics
overview grid, so scrolling — which constantly\nmounts fresh card
instances as new rows come into view — fired a brand\nnew `GET
/internal/synthetics/monitors/maintenance_windows` request for\nevery
card, instead of reusing the one already-cached result.\n\n## Fix\n\nSet
`staleTime` to match the hook's existing `refetchInterval` (5\nminutes)
— the same window during which the data is already known to be\nsafe to
reuse (maintenance windows only take effect on a sync interval,\nand the
existing `refetchInterval` comment explains why 5 minutes is the\nright
cadence). This is a one-line change with no behavior change to
the\nperiodic background polling.\n\n## Testing\n\n- Added a unit test
(`use_fetch_maintenance_windows.test.ts`) asserting\n`staleTime` matches
`refetchInterval`; confirmed red (fails without the\nfix) / green
(passes with it).\n- Verified live: on the Synthetics overview page
(card view), scrolling\nto load new pages of monitors previously fired
one `maintenance_windows`\nrequest per newly-mounted card. After the
fix, scrolling through\nnewly-loaded pages triggers zero additional
requests.\n\n## Test plan\n\n- [x] Unit test added and passing\n- [x]
Verified locally in a real browser (network trace before/after)\n- [x]
`node scripts/eslint --fix` clean\n- [x] Scoped type-check clean
(`synthetics` project full
pass)","sha":"e443f816d1018d365c92bd7a6138be218bde19a9"}}]}] BACKPORT-->
Co-authored-by: Shahzad <shahzad31comp@gmail.com>
1 parent 34662a3 commit 554922f
2 files changed
Lines changed: 44 additions & 0 deletions
File tree
- x-pack/solutions/observability/plugins/synthetics/public/apps/synthetics/hooks
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
0 commit comments