Skip to content

Commit

Permalink
Merge pull request #18335 from Snuffleupagus/watchScroll-cancelAnimat…
Browse files Browse the repository at this point in the history
…ionFrame

Cancel the `requestAnimationFrame` in the `watchScroll` helper (PR 18193 follow-up)
  • Loading branch information
timvandermeij authored Jun 26, 2024
2 parents 6d57908 + 4dad1e3 commit af16aa6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions web/ui_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ function watchScroll(viewAreaElement, callback, abortSignal = undefined) {
useCapture: true,
signal: abortSignal,
});
abortSignal?.addEventListener(
"abort",
() => window.cancelAnimationFrame(rAF),
{ once: true }
);
return state;
}

Expand Down

0 comments on commit af16aa6

Please sign in to comment.