aboutsummaryrefslogtreecommitdiff
path: root/src/App.vue
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2023-01-23 11:37:08 +1100
committerTerry Truong <terry06890@gmail.com>2023-01-23 11:37:08 +1100
commitf6fb429772c02da976f4173907fdaa9ee97a7c99 (patch)
tree3e0423472336149aa7cf80c29792f8315f3a8c5c /src/App.vue
parente212ec2d3f17f68e237cd46e513cbeff2a65fcdb (diff)
Fix some timelines not updating on category change with multiple timelines
Diffstat (limited to 'src/App.vue')
-rw-r--r--src/App.vue16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/App.vue b/src/App.vue
index 96baefd..4a8c3d9 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -82,7 +82,7 @@ import SettingsIcon from './components/icon/SettingsIcon.vue';
import PlusIcon from './components/icon/PlusIcon.vue';
import SearchIcon from './components/icon/SearchIcon.vue';
-import {makeThrottled, makeThrottledSpaced} from './util';
+import {makeThrottledSpaced} from './util';
import {
HistDate, HistEvent, EventInfo, cmpHistEvent,
queryServer, EventResponseJson, jsonToHistEvent, EventInfoJson, jsonToEventInfo,
@@ -359,7 +359,19 @@ async function handleOnEventDisplay(
}
}
-const onEventDisplay = makeThrottled(handleOnEventDisplay, 200);
+const timelineTimeouts: Map<number, number> = new Map();
+ // Maps timeline IDs to setTimeout() timeouts (used to throttle handleEventDisplay() per-timeline)
+
+function onEventDisplay(
+ timelineId: number, eventIds: number[], firstDate: HistDate, lastDate: HistDate, scaleIdx: number){
+ if (timelineTimeouts.has(timelineId)){
+ clearTimeout(timelineTimeouts.get(timelineId));
+ }
+ timelineTimeouts.set(timelineId, window.setTimeout(async () => {
+ timelineTimeouts.delete(timelineId);
+ handleOnEventDisplay(timelineId, eventIds, firstDate, lastDate, scaleIdx);
+ }, 200));
+}
// ========== For info modal ==========