diff --git a/src/renderer/bootstrap.tsx b/src/renderer/bootstrap.tsx index 90e8c7fa95..bcae5a84a3 100644 --- a/src/renderer/bootstrap.tsx +++ b/src/renderer/bootstrap.tsx @@ -50,6 +50,9 @@ import { SentryInit } from "../common/sentry"; import { TerminalStore } from "./components/dock/terminal.store"; import { AppPaths } from "../common/app-paths"; import { registerCustomThemes } from "./components/monaco-editor"; +import { getDi } from "./components/getDi"; +import { DiContextProvider } from "@ogre-tools/injectable-react"; +import type { IDependencyInjectionContainer } from "@ogre-tools/injectable"; if (process.isMainFrame) { SentryInit(); @@ -73,7 +76,7 @@ type AppComponent = React.ComponentType & { init(rootElem: HTMLElement): Promise; }; -export async function bootstrap(comp: () => Promise) { +export async function bootstrap(comp: () => Promise, di: IDependencyInjectionContainer) { const rootElem = document.getElementById("app"); const logPrefix = `[BOOTSTRAP-${process.isMainFrame ? "ROOT" : "CLUSTER"}-FRAME]:`; @@ -147,17 +150,26 @@ export async function bootstrap(comp: () => Promise) { await App.init(rootElem); - render(<> - {isMac &&
} - {DefaultProps(App)} - , rootElem); + render( + + {isMac &&
} + + {DefaultProps(App)} + , + + rootElem, + ); } +const di = getDi(); + // run bootstrap( - async () => process.isMainFrame - ? (await import("./root-frame")).RootFrame - : (await import("./cluster-frame")).ClusterFrame, + async () => + process.isMainFrame + ? (await import("./root-frame")).RootFrame + : (await import("./cluster-frame")).ClusterFrame, + di, ); diff --git a/src/renderer/cluster-frame.tsx b/src/renderer/cluster-frame.tsx index e4e2b148d6..0786ca18a5 100755 --- a/src/renderer/cluster-frame.tsx +++ b/src/renderer/cluster-frame.tsx @@ -22,7 +22,6 @@ import React from "react"; import { observable, makeObservable } from "mobx"; import { disposeOnUnmount, observer } from "mobx-react"; import { Redirect, Route, Router, Switch } from "react-router"; -import { DiContextProvider } from "@ogre-tools/injectable-react"; import { history } from "./navigation"; import { NotFound } from "./components/+404"; import { UserManagement } from "./components/+user-management/user-management"; @@ -74,14 +73,12 @@ import { watchHistoryState } from "./remote-helpers/history-updater"; import { unmountComponentAtNode } from "react-dom"; import { PortForwardDialog } from "./port-forward"; import { DeleteClusterDialog } from "./components/delete-cluster-dialog"; -import { getDi } from "./components/getDi"; @observer export class ClusterFrame extends React.Component { static clusterId: ClusterId; static readonly logPrefix = "[CLUSTER-FRAME]:"; static displayName = "ClusterFrame"; - diContainer = getDi(); constructor(props: {}) { super(props); @@ -196,42 +193,40 @@ export class ClusterFrame extends React.Component { render() { return ( - - - - } footer={}> - - - - - - - - - - - - - {this.renderExtensionTabLayoutRoutes()} - {this.renderExtensionRoutes()} - - - - - - - - - - - - - - - - - - + + + } footer={}> + + + + + + + + + + + + + {this.renderExtensionTabLayoutRoutes()} + {this.renderExtensionRoutes()} + + + + + + + + + + + + + + + + + ); } }