From 7c2268fb81f43e0e258dcdd6878d0a52985a52a5 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Thu, 19 Sep 2024 16:08:59 -0700 Subject: [PATCH] fix for new tab thing (#792) --- frontend/layout/lib/layoutModel.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/frontend/layout/lib/layoutModel.ts b/frontend/layout/lib/layoutModel.ts index 78101cbc8..dc830047f 100644 --- a/frontend/layout/lib/layoutModel.ts +++ b/frontend/layout/lib/layoutModel.ts @@ -302,7 +302,7 @@ export class LayoutModel { * Perform an action against the layout tree state. * @param action The action to perform. */ - treeReducer(action: LayoutTreeAction) { + treeReducer(action: LayoutTreeAction, setState = true) { switch (action.type) { case LayoutTreeActionType.ComputeMove: this.setter( @@ -369,7 +369,7 @@ export class LayoutModel { this.magnifiedNodeId = this.treeState.magnifiedNodeId; } this.updateTree(); - this.setTreeStateAtom(true); + if (setState) this.setTreeStateAtom(true); } } @@ -403,7 +403,7 @@ export class LayoutModel { magnified: action.magnified, focused: action.focused, }; - this.treeReducer(insertNodeAction); + this.treeReducer(insertNodeAction, false); break; } case LayoutTreeActionType.DeleteNode: { @@ -434,13 +434,16 @@ export class LayoutModel { magnified: action.magnified, focused: action.focused, }; - this.treeReducer(insertAction); + this.treeReducer(insertAction, false); break; } case LayoutTreeActionType.ClearTree: { - this.treeReducer({ - type: LayoutTreeActionType.ClearTree, - } as LayoutTreeClearTreeAction); + this.treeReducer( + { + type: LayoutTreeActionType.ClearTree, + } as LayoutTreeClearTreeAction, + false + ); break; } default: @@ -448,6 +451,7 @@ export class LayoutModel { break; } } + this.setTreeStateAtom(true); } else { this.updateTree(); this.setTreeStateAtom(force);