mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
remove workspaces from state after removal from file
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
17f94c58c7
commit
00f176c839
@ -309,6 +309,9 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
|||||||
this.currentWorkspaceId = currentWorkspace;
|
this.currentWorkspaceId = currentWorkspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentWorkspaces = this.workspaces.toJS();
|
||||||
|
const newWorkspaceIds = new Set<WorkspaceId>();
|
||||||
|
|
||||||
for (const workspaceModel of workspaces) {
|
for (const workspaceModel of workspaces) {
|
||||||
const oldWorkspace = this.workspaces.get(workspaceModel.id);
|
const oldWorkspace = this.workspaces.get(workspaceModel.id);
|
||||||
|
|
||||||
@ -317,6 +320,15 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
|||||||
} else {
|
} else {
|
||||||
this.workspaces.set(workspaceModel.id, new Workspace(workspaceModel));
|
this.workspaces.set(workspaceModel.id, new Workspace(workspaceModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newWorkspaceIds.add(workspaceModel.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove deleted workspaces
|
||||||
|
for (const workspaceId of currentWorkspaces.keys()) {
|
||||||
|
if (!newWorkspaceIds.has(workspaceId)) {
|
||||||
|
this.workspaces.delete(workspaceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user