From 0479f3fbbbdcc1191896560acfcc1fe10e4e1cee Mon Sep 17 00:00:00 2001 From: bach Date: Sat, 5 Sep 2026 21:39:47 +0200 Subject: [PATCH] Fix scroll-triggered loading permanently stopping after one round onScroll() throttled via requestAnimationFrame with a guard (_scrollRaf) reset from *inside* the rAF callback -- if that callback ever failed to fire (reproduced via a backgrounded/non-visible tab, where browsers routinely throttle or suspend rAF), the guard stayed true forever, silently dropping every future scroll event. Matches exactly what was reported: the window extends once when scrolling toward the past, then stops responding to scrolling at all. detectCurrentYear()/checkEdges() are cheap (DOM reads + early-return guards, do no real work themselves), so there's nothing worth throttling here -- removed the rAF entirely and call both directly on every scroll event. Verified live: repeated scroll-to-top no longer gets stuck after the first extension, keeps loading older months across many rounds. --- .../custom/figli_compta_ledger/js/home.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/web/modules/custom/figli_compta_ledger/js/home.js b/web/modules/custom/figli_compta_ledger/js/home.js index 32ba520..2b2ce48 100644 --- a/web/modules/custom/figli_compta_ledger/js/home.js +++ b/web/modules/custom/figli_compta_ledger/js/home.js @@ -1013,13 +1013,19 @@ this.loadCurrentYearTotals(); } }, + // No requestAnimationFrame throttle here anymore -- it used a + // "skip if a frame is already pending" guard reset from *inside* + // the rAF callback, which meant a single rAF callback that never + // fires (observed: a backgrounded/non-visible tab, where browsers + // routinely throttle or fully suspend rAF) permanently wedges the + // guard true, silently dropping every future scroll event forever + // -- exactly the "loads once then stops, can't scroll back" bug + // this replaces. detectCurrentYear()/checkEdges() are cheap (DOM + // reads + early-return guards, no work of their own), so calling + // them on every scroll event costs nothing worth throttling for. onScroll() { - if (this._scrollRaf) return; - this._scrollRaf = requestAnimationFrame(() => { - this._scrollRaf = null; - this.detectCurrentYear(); - this.checkEdges(); - }); + this.detectCurrentYear(); + this.checkEdges(); }, // mounted() only runs once, but `v-if="loading"` swaps out the //
for a fresh DOM node every time loading