mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix crash due to trying to read hostedCluster too soon
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
3dbe01e830
commit
266e43b557
@ -3,26 +3,19 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import assert from "assert";
|
|
||||||
import type { ClusterContext } from "./cluster-frame-context";
|
import type { ClusterContext } from "./cluster-frame-context";
|
||||||
import hostedClusterInjectable from "./hosted-cluster.injectable";
|
|
||||||
|
|
||||||
const clusterFrameContextForClusterScopedResourcesInjectable = getInjectable({
|
const clusterFrameContextForClusterScopedResourcesInjectable = getInjectable({
|
||||||
id: "cluster-frame-context-for-cluster-scoped-resources",
|
id: "cluster-frame-context-for-cluster-scoped-resources",
|
||||||
instantiate: (di): ClusterContext => {
|
instantiate: (): ClusterContext => ({
|
||||||
const cluster = di.inject(hostedClusterInjectable);
|
// This doesn't matter as it is an optimization for namespaced resources only
|
||||||
|
isGlobalWatchEnabled: () => true,
|
||||||
assert(cluster, "This can only be injected within a cluster frame");
|
// This is always the case for cluster scoped resources
|
||||||
|
isLoadingAll: () => true,
|
||||||
return {
|
allNamespaces: [],
|
||||||
isGlobalWatchEnabled: () => cluster.isGlobalWatchEnabled,
|
contextNamespaces: [],
|
||||||
// This is always the case for cluster scoped resources
|
hasSelectedAll: true,
|
||||||
isLoadingAll: () => true,
|
}),
|
||||||
allNamespaces: [],
|
|
||||||
contextNamespaces: [], // This value is used as a sentinal
|
|
||||||
hasSelectedAll: true,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default clusterFrameContextForClusterScopedResourcesInjectable;
|
export default clusterFrameContextForClusterScopedResourcesInjectable;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user