From e88e500722e7d9054303ab8dfb07febc10d87521 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Wed, 3 Mar 2021 10:50:50 +0300 Subject: [PATCH] Fetching hosted cluster inside Command Palette Signed-off-by: Alex Andreev --- .../components/command-palette/command-container.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/renderer/components/command-palette/command-container.tsx b/src/renderer/components/command-palette/command-container.tsx index 34ab71ee67..2db9aa08e6 100644 --- a/src/renderer/components/command-palette/command-container.tsx +++ b/src/renderer/components/command-palette/command-container.tsx @@ -8,9 +8,8 @@ import { EventEmitter } from "../../../common/event-emitter"; import { subscribeToBroadcast } from "../../../common/ipc"; import { CommandDialog } from "./command-dialog"; import { CommandRegistration, commandRegistry } from "../../../extensions/registries/command-registry"; -import { clusterStore } from "../../../common/cluster-store"; +import { clusterStore, getHostedCluster } from "../../../common/cluster-store"; import { workspaceStore } from "../../../common/workspace-store"; -import { Cluster } from "../../../main/cluster"; export type CommandDialogEvent = { component: React.ReactElement @@ -29,8 +28,9 @@ export class CommandOverlay { } @observer -export class CommandContainer extends React.Component<{cluster?: Cluster}> { +export class CommandContainer extends React.Component { @observable.ref commandComponent: React.ReactElement; + @observable cluster = getHostedCluster(); private escHandler(event: KeyboardEvent) { if (event.key === "Escape") { @@ -56,8 +56,8 @@ export class CommandContainer extends React.Component<{cluster?: Cluster}> { } componentDidMount() { - if (this.props.cluster) { - subscribeToBroadcast(`command-palette:run-action:${this.props.cluster.id}`, (event, commandId: string) => { + if (this.cluster) { + subscribeToBroadcast(`command-palette:run-action:${this.cluster.id}`, (event, commandId: string) => { const command = this.findCommandById(commandId); if (command) {