mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
Fix new tab bug that would remove terminal block (#1006)
This commit is contained in:
parent
bd5e6223f3
commit
a109ccfec8
@ -43,7 +43,7 @@ export function withLayoutTreeStateAtomFromTab(tabAtom: Atom<Tab>): WritableLayo
|
||||
waveObjVal.magnifiednodeid = value.magnifiedNodeId;
|
||||
waveObjVal.focusednodeid = value.focusedNodeId;
|
||||
waveObjVal.leaforder = value.leafOrder; // only set leaforder, never get it, since this value is driven by the frontend
|
||||
waveObjVal.pendingbackendactions = value.pendingBackendActions?.length
|
||||
waveObjVal.pendingbackendactions = value?.pendingBackendActions?.length
|
||||
? value.pendingBackendActions
|
||||
: undefined;
|
||||
set(generationAtom, value.generation);
|
||||
|
@ -389,7 +389,7 @@ export class LayoutModel {
|
||||
) {
|
||||
this.treeState = treeState;
|
||||
|
||||
if (this.treeState.pendingBackendActions?.length) {
|
||||
if (this.treeState?.pendingBackendActions?.length) {
|
||||
const actions = this.treeState.pendingBackendActions;
|
||||
this.treeState.pendingBackendActions = undefined;
|
||||
for (const action of actions) {
|
||||
@ -631,7 +631,7 @@ export class LayoutModel {
|
||||
// Remove duplicates and stale entries from focus stack.
|
||||
const newFocusedNodeIdStack: string[] = [];
|
||||
for (const id of this.focusedNodeIdStack) {
|
||||
if (leafOrder.find((leafEntry) => leafEntry.nodeid === id) && !newFocusedNodeIdStack.includes(id))
|
||||
if (leafOrder.find((leafEntry) => leafEntry?.nodeid === id) && !newFocusedNodeIdStack.includes(id))
|
||||
newFocusedNodeIdStack.push(id);
|
||||
}
|
||||
this.focusedNodeIdStack = newFocusedNodeIdStack;
|
||||
@ -640,7 +640,7 @@ export class LayoutModel {
|
||||
if (!this.treeState.focusedNodeId) {
|
||||
if (this.focusedNodeIdStack.length > 0) {
|
||||
this.treeState.focusedNodeId = this.focusedNodeIdStack.shift();
|
||||
} else {
|
||||
} else if (leafOrder.length > 0) {
|
||||
// If no nodes are in the stack, use the top left node in the layout.
|
||||
this.treeState.focusedNodeId = leafOrder[0].nodeid;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user