https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42799

--- Comment #9 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 201646
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201646&action=edit
Bug 42799: (QA follow-up) Close scroll listener leak in apply_sticky

apply_sticky is invoked from a watch() in Toolbar.vue every time the
toolbar element (re)mounts. The scroll listener it registers was never
removed, so long-lived SPA modules (ERM, ILL, Acquisitions,
Preservation, SIP2) that mount/unmount this Toolbar as the user
navigates between records leaked another window-level scroll listener
on every remount.

An IntersectionObserver + sentinel node was tried instead, since it's
the standard technique and doesn't poll on every scroll frame, but
verified against KTD/Cypress it fails
t/cypress/integration/Toolbar_spec.ts consistently: the observer's
callback fires once on attach and never fires again after
cy.scrollTo("bottom"), even though the sentinel is confirmed (via
instrumentation) to have scrolled fully out of the viewport. The
scroll-listener approach passes the same spec reliably across repeated
runs. So the scroll listener stays; apply_sticky now returns a
disconnect() callback and Toolbar.vue calls it before re-applying and
on unmount, closing the leak without touching detection behaviour.

Test plan:
1. Rebuild assets (yarn build) and confirm:
     yarn cypress run --spec t/cypress/integration/Toolbar_spec.ts
   passes consistently across several runs.
2. Manually confirm sticky toolbars in ERM, Acquisitions (vendors),
   ILL, Preservation and SIP2 still float correctly on scroll, and that
   navigating between several records doesn't accumulate extra "scroll"
   listeners on window (DevTools -> getEventListeners(window)).

Signed-off-by: Martin Renvoize <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to