diff --git a/src/common/cluster-store.ts b/src/common/cluster-store.ts index 7ea92b612a..a2dcccd338 100644 --- a/src/common/cluster-store.ts +++ b/src/common/cluster-store.ts @@ -1,4 +1,4 @@ -import type { WorkspaceId } from "./workspace-store"; +import { WorkspaceId, workspaceStore } from "./workspace-store"; import path from "path"; import { app, ipcRenderer, remote, webFrame } from "electron"; import { unlink } from "fs-extra"; @@ -138,7 +138,9 @@ export class ClusterStore extends BaseStore { @action setActive(id: ClusterId) { - this.activeCluster = this.clusters.has(id) ? id : null; + const clusterId = this.clusters.has(id) ? id : null; + this.activeCluster = clusterId; + workspaceStore.setLastActiveClusterId(clusterId); } @action diff --git a/src/common/workspace-store.ts b/src/common/workspace-store.ts index 33e92e8db0..5b2d6cf174 100644 --- a/src/common/workspace-store.ts +++ b/src/common/workspace-store.ts @@ -72,7 +72,8 @@ export class Workspace implements WorkspaceModel, WorkspaceState { id: this.id, name: this.name, description: this.description, - ownerRef: this.ownerRef + ownerRef: this.ownerRef, + lastActiveClusterId: this.lastActiveClusterId }) } } @@ -191,6 +192,7 @@ export class WorkspaceStore extends BaseStore { @action setLastActiveClusterId(clusterId: ClusterId, workspaceId = this.currentWorkspaceId) { + console.log("Passed cluster ID", clusterId, "current workspace id = ", workspaceId) if (clusterId != null) { this.getById(workspaceId).lastActiveClusterId = clusterId; } diff --git a/src/main/tray.ts b/src/main/tray.ts index 5bc6ce7091..435139209a 100644 --- a/src/main/tray.ts +++ b/src/main/tray.ts @@ -94,7 +94,6 @@ export function createTrayMenu(windowManager: WindowManager): Menu { toolTip: clusterId, async click() { workspaceStore.setActive(workspace); - clusterStore.setActive(clusterId); windowManager.navigate(clusterViewURL({ params: { clusterId } })); } } diff --git a/src/renderer/components/+add-cluster/add-cluster.tsx b/src/renderer/components/+add-cluster/add-cluster.tsx index 6bf439930c..8acd3a51ea 100644 --- a/src/renderer/components/+add-cluster/add-cluster.tsx +++ b/src/renderer/components/+add-cluster/add-cluster.tsx @@ -167,7 +167,6 @@ export class AddCluster extends React.Component { if (newClusters.length === 1) { const clusterId = newClusters[0].id; clusterStore.setActive(clusterId); - workspaceStore.setLastActiveClusterId(clusterId); navigate(clusterViewURL({ params: { clusterId } })); } else { if (newClusters.length > 1) { diff --git a/src/renderer/components/cluster-manager/clusters-menu.tsx b/src/renderer/components/cluster-manager/clusters-menu.tsx index e99333fccb..5ff5cabe13 100644 --- a/src/renderer/components/cluster-manager/clusters-menu.tsx +++ b/src/renderer/components/cluster-manager/clusters-menu.tsx @@ -31,7 +31,6 @@ interface Props { @observer export class ClustersMenu extends React.Component { showCluster = (clusterId: ClusterId) => { - workspaceStore.setLastActiveClusterId(clusterId); navigate(clusterViewURL({ params: { clusterId } })); }