fix for new tab thing (#792)

This commit is contained in:
Evan Simkowitz 2024-09-19 16:08:59 -07:00 committed by GitHub
parent 466a659ef2
commit 7c2268fb81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -302,7 +302,7 @@ export class LayoutModel {
* Perform an action against the layout tree state. * Perform an action against the layout tree state.
* @param action The action to perform. * @param action The action to perform.
*/ */
treeReducer(action: LayoutTreeAction) { treeReducer(action: LayoutTreeAction, setState = true) {
switch (action.type) { switch (action.type) {
case LayoutTreeActionType.ComputeMove: case LayoutTreeActionType.ComputeMove:
this.setter( this.setter(
@ -369,7 +369,7 @@ export class LayoutModel {
this.magnifiedNodeId = this.treeState.magnifiedNodeId; this.magnifiedNodeId = this.treeState.magnifiedNodeId;
} }
this.updateTree(); this.updateTree();
this.setTreeStateAtom(true); if (setState) this.setTreeStateAtom(true);
} }
} }
@ -403,7 +403,7 @@ export class LayoutModel {
magnified: action.magnified, magnified: action.magnified,
focused: action.focused, focused: action.focused,
}; };
this.treeReducer(insertNodeAction); this.treeReducer(insertNodeAction, false);
break; break;
} }
case LayoutTreeActionType.DeleteNode: { case LayoutTreeActionType.DeleteNode: {
@ -434,13 +434,16 @@ export class LayoutModel {
magnified: action.magnified, magnified: action.magnified,
focused: action.focused, focused: action.focused,
}; };
this.treeReducer(insertAction); this.treeReducer(insertAction, false);
break; break;
} }
case LayoutTreeActionType.ClearTree: { case LayoutTreeActionType.ClearTree: {
this.treeReducer({ this.treeReducer(
type: LayoutTreeActionType.ClearTree, {
} as LayoutTreeClearTreeAction); type: LayoutTreeActionType.ClearTree,
} as LayoutTreeClearTreeAction,
false
);
break; break;
} }
default: default:
@ -448,6 +451,7 @@ export class LayoutModel {
break; break;
} }
} }
this.setTreeStateAtom(true);
} else { } else {
this.updateTree(); this.updateTree();
this.setTreeStateAtom(force); this.setTreeStateAtom(force);