Remove ClusterStore.removedClusters and correctly delete lens storage file (#4077)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-10-20 08:51:26 -04:00
1 parent b4a4cc6be4
commit 32562b11a4
5 files changed
+19 -40

No files matched your search

-10
View File
@@ -40,7 +40,6 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
private static StateChannel = "cluster:state";
clusters = observable.map<ClusterId, Cluster>();
removedClusters = observable.map<ClusterId, Cluster>();
protected disposer = disposer();
@@ -144,7 +143,6 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
protected fromStore({ clusters = [] }: ClusterStoreModel = {}) {
const currentClusters = new Map(this.clusters);
const newClusters = new Map<ClusterId, Cluster>();
const removedClusters = new Map<ClusterId, Cluster>();
// update new clusters
for (const clusterModel of clusters) {
@@ -162,15 +160,7 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
}
}
// update removed clusters
currentClusters.forEach(cluster => {
if (!newClusters.has(cluster.id)) {
removedClusters.set(cluster.id, cluster);
}
});
this.clusters.replace(newClusters);
this.removedClusters.replace(removedClusters);
}
toJSON(): ClusterStoreModel {