From 2f5a989bf4ca944888cc16d06339fec237f60319 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Wed, 19 Oct 2022 19:26:52 +1100
Subject: Move event labels to below images

Add client-side REQ_EXCLS_LIMIT
Rename posX and posY vars in idToPos computed
---
 src/App.vue | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index 442d3cb..e836fbf 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -84,7 +84,7 @@ function onTimelineChg(state: TimelineState, idx: number){
 }
 
 // For timeline addition/removal
-const MIN_TIMELINE_BREADTH = 80 + 10 * 2 + 115; // TODO: Link with constants in components/TimeLine.vue
+const MIN_TIMELINE_BREADTH = 80 + 10 * 2 + 120; // TODO: Link with constants in components/TimeLine.vue
 function onTimelineAdd(){
 	if (vert.value && contentWidth.value / (timelines.value.length + 1) < MIN_TIMELINE_BREADTH ||
 		!vert.value && contentHeight.value / (timelines.value.length + 1) < MIN_TIMELINE_BREADTH){
@@ -192,6 +192,7 @@ function reduceEvents(){
 }
 // For getting events from server
 const EVENT_REQ_LIMIT = 30;
+const REQ_EXCLS_LIMIT = 100;
 let pendingReq = false; // Used to serialise event-req handling
 async function onEventReq(startDate: HistDate, endDate: HistDate){
 	while (pendingReq){
@@ -214,6 +215,11 @@ async function onEventReq(startDate: HistDate, endDate: HistDate){
 		}
 		existingEventIds.push(event.id);
 	}
+	if (existingEventIds.length > REQ_EXCLS_LIMIT){
+		console.log('WARNING: Exceeded request exclusions limit');
+		pendingReq = false;
+		return;
+	}
 	// Get events from server
 	let urlParams = new URLSearchParams({
 		type: 'events',
-- 
cgit v1.2.3

