From d9e6a85feb9a59822c0aee44ad2789282b98f6a4 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Tue, 17 Oct 2023 14:27:16 +0100 Subject: [PATCH] Ensure items in timeline view are visible --- .../lib/knockout/bindings/virtual-foreach.js | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/view/adminhtml/web/js/lib/knockout/bindings/virtual-foreach.js b/view/adminhtml/web/js/lib/knockout/bindings/virtual-foreach.js index bdc2f143..cd96e67c 100644 --- a/view/adminhtml/web/js/lib/knockout/bindings/virtual-foreach.js +++ b/view/adminhtml/web/js/lib/knockout/bindings/virtual-foreach.js @@ -202,28 +202,22 @@ define([ } }; - var windowTimer = null; - $(window).on('scroll', function() { - if (windowTimer !== null) { - clearTimeout(windowTimer); + var debounceRefresh = function() { + if (debounceRefresh.timer) { + clearTimeout(debounceRefresh.timer); } - windowTimer = setTimeout(function() { + + debounceRefresh.timer = setTimeout(function() { raf(refresh); }, 150); - }); + }; - var panelTimer = null; - $timelinePanel.on('scroll', function() { - if (panelTimer !== null) { - clearTimeout(panelTimer); - } - panelTimer = setTimeout(function() { - raf(refresh); - }, 1000); - }); + $(window).on('scroll', debounceRefresh); + $timelinePanel.on('scroll', debounceRefresh); + $timelineCont.on('scroll', debounceRefresh); $timelineCont.on('timeline.ready', function() { - $(window).trigger('scroll'); + debounceRefresh(); loader.get('timeline_container.timeline_panel').hide(); });