From f5e87ae628bab0eef97b3e3e62f6d71cca9c99c0 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Sat, 28 Jan 2023 21:37:37 +1100
Subject: Fix potential redundant handler calls in onResize()

---
 src/App.vue | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index c3dbd04..ee1380e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -268,7 +268,7 @@ async function onResize(){
 			updateAreaDims();
 			relayoutWithCollapse();
 		} else {
-			reInit();
+			await reInit();
 		}
 	};
 	let currentTime = new Date().getTime();
@@ -282,7 +282,10 @@ async function onResize(){
 	afterResizeHdlr = setTimeout(async () => {
 		afterResizeHdlr = 0;
 		await handleResize();
-		lastResizeHdlrTime = new Date().getTime();
+		let newTime = new Date().getTime();
+		if (newTime > lastResizeHdlrTime){
+			lastResizeHdlrTime = newTime;
+		}
 	}, 200); // If too small, touch-device detection when swapping to/from mobile-mode gets unreliable
 }
 onMounted(() => window.addEventListener('resize', onResize));
-- 
cgit v1.2.3

