From 311497dbfca829b2e24dfdeb443b7cb5f0bffffd Mon Sep 17 00:00:00 2001 From: Roman Dvornov Date: Fri, 29 Mar 2024 03:09:41 +0100 Subject: [PATCH] Tweak debounce --- app/pages/default.js | 3 +++ app/views/update-on-timings-change.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/pages/default.js b/app/pages/default.js index 3faa96d..29affbc 100644 --- a/app/pages/default.js +++ b/app/pages/default.js @@ -225,6 +225,7 @@ const packagesList = { view: 'content-filter', content: { view: 'update-on-timings-change', + debounce: true, content: { view: 'table', data: 'entries.[totalTime and entry.name ~= #.filter].sort(selfTime desc, totalTime desc)', @@ -253,6 +254,7 @@ const modulesList = { view: 'content-filter', content: { view: 'update-on-timings-change', + debounce: true, content: { view: 'table', data: `entries @@ -284,6 +286,7 @@ const functionList = { view: 'content-filter', content: { view: 'update-on-timings-change', + debounce: true, content: { view: 'table', data: 'entries.[totalTime and entry.name ~= #.filter].sort(selfTime desc, totalTime desc)', diff --git a/app/views/update-on-timings-change.js b/app/views/update-on-timings-change.js index 36229fa..0b36697 100644 --- a/app/views/update-on-timings-change.js +++ b/app/views/update-on-timings-change.js @@ -4,7 +4,7 @@ discovery.view.define('update-on-timings-change', function(el, config, data, con const { timings = data, debounce, content } = config; let scheduledRender = null; const updateRender = () => { - if (scheduledRender) { + if (scheduledRender !== null) { return; } @@ -18,7 +18,7 @@ discovery.view.define('update-on-timings-change', function(el, config, data, con const unsubscribeSource = timings.on( debounce - ? utils.debounce(updateRender, debounce !== true ? debounce : { wait: 16, maxWait: 32 }) + ? utils.debounce(updateRender, debounce !== true ? debounce : { wait: 16, maxWait: 48 }) : updateRender );