mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-03-11 13:23:06 +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.magnifiednodeid = value.magnifiedNodeId;
|
||||||
waveObjVal.focusednodeid = value.focusedNodeId;
|
waveObjVal.focusednodeid = value.focusedNodeId;
|
||||||
waveObjVal.leaforder = value.leafOrder; // only set leaforder, never get it, since this value is driven by the frontend
|
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
|
? value.pendingBackendActions
|
||||||
: undefined;
|
: undefined;
|
||||||
set(generationAtom, value.generation);
|
set(generationAtom, value.generation);
|
||||||
|
@ -389,7 +389,7 @@ export class LayoutModel {
|
|||||||
) {
|
) {
|
||||||
this.treeState = treeState;
|
this.treeState = treeState;
|
||||||
|
|
||||||
if (this.treeState.pendingBackendActions?.length) {
|
if (this.treeState?.pendingBackendActions?.length) {
|
||||||
const actions = this.treeState.pendingBackendActions;
|
const actions = this.treeState.pendingBackendActions;
|
||||||
this.treeState.pendingBackendActions = undefined;
|
this.treeState.pendingBackendActions = undefined;
|
||||||
for (const action of actions) {
|
for (const action of actions) {
|
||||||
@ -631,7 +631,7 @@ export class LayoutModel {
|
|||||||
// Remove duplicates and stale entries from focus stack.
|
// Remove duplicates and stale entries from focus stack.
|
||||||
const newFocusedNodeIdStack: string[] = [];
|
const newFocusedNodeIdStack: string[] = [];
|
||||||
for (const id of this.focusedNodeIdStack) {
|
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);
|
newFocusedNodeIdStack.push(id);
|
||||||
}
|
}
|
||||||
this.focusedNodeIdStack = newFocusedNodeIdStack;
|
this.focusedNodeIdStack = newFocusedNodeIdStack;
|
||||||
@ -640,7 +640,7 @@ export class LayoutModel {
|
|||||||
if (!this.treeState.focusedNodeId) {
|
if (!this.treeState.focusedNodeId) {
|
||||||
if (this.focusedNodeIdStack.length > 0) {
|
if (this.focusedNodeIdStack.length > 0) {
|
||||||
this.treeState.focusedNodeId = this.focusedNodeIdStack.shift();
|
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.
|
// If no nodes are in the stack, use the top left node in the layout.
|
||||||
this.treeState.focusedNodeId = leafOrder[0].nodeid;
|
this.treeState.focusedNodeId = leafOrder[0].nodeid;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user