From 4dad1e34b99affdcdfcab480c48dec794b0a79c7 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 26 Jun 2024 16:31:07 +0200 Subject: [PATCH] Cancel the `requestAnimationFrame` in the `watchScroll` helper (PR 18193 follow-up) While the event listener is removed during testing, the `requestAnimationFrame` isn't cancelled and that occasionally shows up when the integration-tests are run on the bots. --- web/ui_utils.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/ui_utils.js b/web/ui_utils.js index 6608c3640..1ed7e5a3d 100644 --- a/web/ui_utils.js +++ b/web/ui_utils.js @@ -193,6 +193,11 @@ function watchScroll(viewAreaElement, callback, abortSignal = undefined) { useCapture: true, signal: abortSignal, }); + abortSignal?.addEventListener( + "abort", + () => window.cancelAnimationFrame(rAF), + { once: true } + ); return state; }