1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

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 <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-07-22 15:08:10 -04:00
parent d8c62fff82
commit dc6bbca0ad
2 changed files with 6 additions and 1 deletions

View File

@ -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();

View File

@ -68,6 +68,11 @@ class NonInjectedClusterView extends React.Component<Dependencies> {
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