Fix: preventing <App/> to render on cluster refresh (#2253)

* Removing @observer decorator from <App/>

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Add observer wrapper to <MainLayoutHeader/>

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fix eslint claim

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Moving extension route renderers to components

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Clean up

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Removing external observables out from App render()

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fetching hosted cluster inside Command Palette

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Setting route lists explicitly
To avoid using observable data within tabRoutes arrays

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Review fixes

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev authored and GitHub committed 2021-03-04 14:12:28 +02:00
1 parent bcaef79386
commit 852aa1147f
11 files changed
+70 -96

No files matched your search

@@ -10,7 +10,6 @@ import { CommandDialog } from "./command-dialog";
import { CommandRegistration, commandRegistry } from "../../../extensions/registries/command-registry";
import { clusterStore } from "../../../common/cluster-store";
import { workspaceStore } from "../../../common/workspace-store";
import { Cluster } from "../../../main/cluster";
export type CommandDialogEvent = {
component: React.ReactElement
@@ -29,7 +28,7 @@ export class CommandOverlay {
}
@observer
export class CommandContainer extends React.Component<{cluster?: Cluster}> {
export class CommandContainer extends React.Component<{ clusterId?: string }> {
@observable.ref commandComponent: React.ReactElement;
private escHandler(event: KeyboardEvent) {
@@ -56,8 +55,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.props.clusterId) {
subscribeToBroadcast(`command-palette:run-action:${this.props.clusterId}`, (event, commandId: string) => {
const command = this.findCommandById(commandId);
if (command) {