From 0e5ec48af629a9a9c235b07cc176491e7f2ef860 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Fri, 1 Jul 2022 22:58:17 +1000
Subject: Fix abruptness/cancellation of an expansion done quickly after a
 tree-setting change

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

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index 13da971..e368342 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -872,7 +872,7 @@ export default defineComponent({
 			}
 		},
 		// For initialisation
-		async initTreeFromServer(){
+		async initTreeFromServer(firstInit = true){
 			// Query server
 			let urlParams = 'type=node';
 			urlParams += '&tree=' + this.uiOpts.tree;
@@ -903,8 +903,10 @@ export default defineComponent({
 			await this.updateAreaDims();
 			this.relayoutWithCollapse(false);
 			// Skip initial transition
-			this.justInitialised = true;
-			setTimeout(() => {this.justInitialised = false}, this.uiOpts.transitionDuration);
+			if (firstInit){
+				this.justInitialised = true;
+				setTimeout(() => {this.justInitialised = false}, this.uiOpts.transitionDuration);
+			}
 		},
 		async reInit(){
 			if (this.activeRoot != this.layoutTree){
@@ -912,8 +914,7 @@ export default defineComponent({
 				await this.onDetachedAncestorClick(this.layoutTree);
 			}
 			await this.onNonleafClick(this.layoutTree);
-			await timeout(this.uiOpts.transitionDuration);
-			await this.initTreeFromServer();
+			await this.initTreeFromServer(false);
 		},
 		getLytOpts(): LayoutOptions {
 			let opts = getDefaultLytOpts();
-- 
cgit v1.2.3

