From dc6bbca0ad32f68dc3833a0efed15b0dd5e73869 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 22 Jul 2022 15:08:10 -0400 Subject: [PATCH] Fix trying to connect to cluster whose entity doesn't exist - If a Cluster is trying to be connected to but there is no associated entity then don't try and connect Signed-off-by: Sebastian Malton --- src/renderer/api/catalog/entity/registry.ts | 2 +- src/renderer/components/cluster-manager/cluster-view.tsx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/renderer/api/catalog/entity/registry.ts b/src/renderer/api/catalog/entity/registry.ts index 1f53cf3d94..42035d6306 100644 --- a/src/renderer/api/catalog/entity/registry.ts +++ b/src/renderer/api/catalog/entity/registry.ts @@ -60,7 +60,7 @@ export class CatalogEntityRegistry { // If the entity was not found but there are rawEntities to be processed, // try to process them and return the entity. // This might happen if an extension registered a new Catalog category. - if (this.activeEntityId && !entity && this.rawEntities.length > 0) { + if (this.activeEntityId.get() && !entity && this.rawEntities.length > 0) { this.processRawEntities(); return this.getActiveEntityById(); diff --git a/src/renderer/components/cluster-manager/cluster-view.tsx b/src/renderer/components/cluster-manager/cluster-view.tsx index 1eba3195a9..4129817fa0 100644 --- a/src/renderer/components/cluster-manager/cluster-view.tsx +++ b/src/renderer/components/cluster-manager/cluster-view.tsx @@ -68,6 +68,11 @@ class NonInjectedClusterView extends React.Component { bindEvents() { disposeOnUnmount(this, [ reaction(() => this.clusterId, async (clusterId) => { + // TODO: replace with better handling + if (clusterId && !this.props.entityRegistry.getById(clusterId)) { + return this.props.navigateToCatalog(); // redirect to catalog when the clusterId does not correspond to an entity + } + this.props.clusterFrames.setVisibleCluster(clusterId); this.props.clusterFrames.initView(clusterId); requestClusterActivation(clusterId, false); // activate and fetch cluster's state from main