From dfe71f33e24b9ed5b8ecc674423216a0f5487283 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Tue, 18 Oct 2022 20:03:51 +1100 Subject: Serialise event-req handling Also skip unnecessary render on startup --- src/components/TimeLine.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/components/TimeLine.vue') diff --git a/src/components/TimeLine.vue b/src/components/TimeLine.vue index 577413d..88ac62d 100644 --- a/src/components/TimeLine.vue +++ b/src/components/TimeLine.vue @@ -254,7 +254,6 @@ const ticks = computed((): Ticks => { }); // For displayed events -let pendingReq = false; const idToEvent = computed(() => { // Maps visible event IDs to HistEvents let map: Map = new Map(); // Find events to display @@ -267,10 +266,12 @@ const idToEvent = computed(() => { // Maps visible event IDs to HistEvents } map.set(event.id, event); } - pendingReq = false; return map; }); const idToPos = computed(() => { + if (!mounted.value){ + return new Map(); + } let map: Map = new Map(); // Maps visible event IDs to x/y/w/h let numUnits = getNumVisibleUnits(); let minorAxisStep = 0; @@ -283,12 +284,11 @@ const idToPos = computed(() => { minorAxisStep += 10; } // If more events could be displayed, notify parent - if (map.size < 3 && !pendingReq){ + if (map.size < 3){ emit('event-req', startDate.value, endDate.value); } else { // Send displayed event IDs to parent emit('event-display', [...idToEvent.value.keys()], ID); } - pendingReq = true; // return map; }); -- cgit v1.2.3