From 331c4ddb8aec9a67364fe512a27a79c1600edf6e Mon Sep 17 00:00:00 2001 From: ekremney Date: Thu, 31 Oct 2024 14:18:17 +0100 Subject: [PATCH 1/2] fix(rum-explorer): introduces 3s debounce to filter input field --- tools/oversight/slicer.js | 8 ++++++-- tools/rum/slicer.js | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/oversight/slicer.js b/tools/oversight/slicer.js index 9e6a4aac..deab9dc4 100644 --- a/tools/oversight/slicer.js +++ b/tools/oversight/slicer.js @@ -431,9 +431,13 @@ const io = new IntersectionObserver((entries) => { loadData(elems.viewSelect.value).then(draw); } + let filterInputDebounce; elems.filterInput.addEventListener('input', () => { - updateState(); - draw(); + clearTimeout(filterInputDebounce); + filterInputDebounce = setTimeout(() => { + updateState(); + draw(); + }, 3000); }); elems.viewSelect.addEventListener('change', () => { diff --git a/tools/rum/slicer.js b/tools/rum/slicer.js index 30f024c9..25b14bb4 100644 --- a/tools/rum/slicer.js +++ b/tools/rum/slicer.js @@ -381,9 +381,13 @@ const io = new IntersectionObserver((entries) => { loadData(elems.viewSelect.value).then(draw); } + let filterInputDebounce; elems.filterInput.addEventListener('input', () => { - updateState(); - draw(); + clearTimeout(filterInputDebounce); + filterInputDebounce = setTimeout(() => { + updateState(); + draw(); + }, 3000); }); elems.viewSelect.addEventListener('change', () => { From a79d8358c8fd81a495f61b0e319af91b4fdd9c67 Mon Sep 17 00:00:00 2001 From: ekremney Date: Thu, 31 Oct 2024 15:16:26 +0100 Subject: [PATCH 2/2] fix(rum-explorer): debounce only the view is weekly --- tools/oversight/slicer.js | 3 ++- tools/rum/slicer.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/oversight/slicer.js b/tools/oversight/slicer.js index deab9dc4..d0606a58 100644 --- a/tools/oversight/slicer.js +++ b/tools/oversight/slicer.js @@ -432,12 +432,13 @@ const io = new IntersectionObserver((entries) => { } let filterInputDebounce; + const debounceTimeout = view === 'week' ? 1000 : 0; elems.filterInput.addEventListener('input', () => { clearTimeout(filterInputDebounce); filterInputDebounce = setTimeout(() => { updateState(); draw(); - }, 3000); + }, debounceTimeout); }); elems.viewSelect.addEventListener('change', () => { diff --git a/tools/rum/slicer.js b/tools/rum/slicer.js index 25b14bb4..e743e54a 100644 --- a/tools/rum/slicer.js +++ b/tools/rum/slicer.js @@ -382,12 +382,13 @@ const io = new IntersectionObserver((entries) => { } let filterInputDebounce; + const debounceTimeout = view === 'week' ? 1000 : 0; elems.filterInput.addEventListener('input', () => { clearTimeout(filterInputDebounce); filterInputDebounce = setTimeout(() => { updateState(); draw(); - }, 3000); + }, debounceTimeout); }); elems.viewSelect.addEventListener('change', () => {