mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Moving CacheProvider into bootstrap
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
eab03bf03f
commit
2418de9140
@ -19,6 +19,8 @@ import { filesystemProvisionerStore } from "../main/extension-filesystem";
|
||||
import { App } from "./components/app";
|
||||
import { LensApp } from "./lens-app";
|
||||
import { themeStore } from "./theme.store";
|
||||
import { CacheProvider } from "@emotion/react";
|
||||
import createCache from "@emotion/cache";
|
||||
|
||||
/**
|
||||
* If this is a development buid, wait a second to attach
|
||||
@ -82,7 +84,9 @@ export async function bootstrap(App: AppComponent) {
|
||||
});
|
||||
render(<>
|
||||
{isMac && <div id="draggable-top" />}
|
||||
<App />
|
||||
<CacheProvider value={createCache({ key: "lens" })}>
|
||||
<App />
|
||||
</CacheProvider>
|
||||
</>, rootElem);
|
||||
}
|
||||
|
||||
|
||||
@ -50,8 +50,6 @@ import { ReplicaSetScaleDialog } from "./+workloads-replicasets/replicaset-scale
|
||||
import { CommandContainer } from "./command-palette/command-container";
|
||||
import { KubeObjectStore } from "../kube-object.store";
|
||||
import { clusterContext } from "./context";
|
||||
import { CacheProvider } from "@emotion/react";
|
||||
import createCache from "@emotion/cache";
|
||||
|
||||
@observer
|
||||
export class App extends React.Component {
|
||||
@ -155,39 +153,37 @@ export class App extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<Router history={history}>
|
||||
<CacheProvider value={createCache({ key: "dashboard" })}>
|
||||
<ErrorBoundary>
|
||||
<MainLayout>
|
||||
<Switch>
|
||||
<Route component={ClusterOverview} {...clusterRoute}/>
|
||||
<Route component={Nodes} {...nodesRoute}/>
|
||||
<Route component={Workloads} {...workloadsRoute}/>
|
||||
<Route component={Config} {...configRoute}/>
|
||||
<Route component={Network} {...networkRoute}/>
|
||||
<Route component={Storage} {...storageRoute}/>
|
||||
<Route component={Namespaces} {...namespacesRoute}/>
|
||||
<Route component={Events} {...eventRoute}/>
|
||||
<Route component={CustomResources} {...crdRoute}/>
|
||||
<Route component={UserManagement} {...usersManagementRoute}/>
|
||||
<Route component={Apps} {...appsRoute}/>
|
||||
{this.renderExtensionTabLayoutRoutes()}
|
||||
{this.renderExtensionRoutes()}
|
||||
<Redirect exact from="/" to={this.startUrl}/>
|
||||
<Route component={NotFound}/>
|
||||
</Switch>
|
||||
</MainLayout>
|
||||
<Notifications/>
|
||||
<ConfirmDialog/>
|
||||
<KubeObjectDetails/>
|
||||
<KubeConfigDialog/>
|
||||
<AddRoleBindingDialog/>
|
||||
<DeploymentScaleDialog/>
|
||||
<StatefulSetScaleDialog/>
|
||||
<ReplicaSetScaleDialog/>
|
||||
<CronJobTriggerDialog/>
|
||||
<CommandContainer clusterId={getHostedCluster()?.id}/>
|
||||
</ErrorBoundary>
|
||||
</CacheProvider>
|
||||
<ErrorBoundary>
|
||||
<MainLayout>
|
||||
<Switch>
|
||||
<Route component={ClusterOverview} {...clusterRoute}/>
|
||||
<Route component={Nodes} {...nodesRoute}/>
|
||||
<Route component={Workloads} {...workloadsRoute}/>
|
||||
<Route component={Config} {...configRoute}/>
|
||||
<Route component={Network} {...networkRoute}/>
|
||||
<Route component={Storage} {...storageRoute}/>
|
||||
<Route component={Namespaces} {...namespacesRoute}/>
|
||||
<Route component={Events} {...eventRoute}/>
|
||||
<Route component={CustomResources} {...crdRoute}/>
|
||||
<Route component={UserManagement} {...usersManagementRoute}/>
|
||||
<Route component={Apps} {...appsRoute}/>
|
||||
{this.renderExtensionTabLayoutRoutes()}
|
||||
{this.renderExtensionRoutes()}
|
||||
<Redirect exact from="/" to={this.startUrl}/>
|
||||
<Route component={NotFound}/>
|
||||
</Switch>
|
||||
</MainLayout>
|
||||
<Notifications/>
|
||||
<ConfirmDialog/>
|
||||
<KubeObjectDetails/>
|
||||
<KubeConfigDialog/>
|
||||
<AddRoleBindingDialog/>
|
||||
<DeploymentScaleDialog/>
|
||||
<StatefulSetScaleDialog/>
|
||||
<ReplicaSetScaleDialog/>
|
||||
<CronJobTriggerDialog/>
|
||||
<CommandContainer clusterId={getHostedCluster()?.id}/>
|
||||
</ErrorBoundary>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
@ -15,9 +15,7 @@ import { CommandContainer } from "./components/command-palette/command-container
|
||||
import { LensProtocolRouterRenderer, bindProtocolAddRouteHandlers } from "./protocol-handler";
|
||||
import { registerIpcHandlers } from "./ipc";
|
||||
import { ipcRenderer } from "electron";
|
||||
import { CacheProvider } from "@emotion/react";
|
||||
import { IpcRendererNavigationEvents } from "./navigation/events";
|
||||
import createCache from "@emotion/cache";
|
||||
|
||||
@observer
|
||||
export class LensApp extends React.Component {
|
||||
@ -39,18 +37,16 @@ export class LensApp extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<Router history={history}>
|
||||
<CacheProvider value={createCache({ key: "app" })}>
|
||||
<ErrorBoundary>
|
||||
<Switch>
|
||||
{userStore.isNewVersion && <Route component={WhatsNew}/>}
|
||||
<Route component={WhatsNew} {...whatsNewRoute}/>
|
||||
<Route component={ClusterManager}/>
|
||||
</Switch>
|
||||
</ErrorBoundary>
|
||||
<Notifications/>
|
||||
<ConfirmDialog/>
|
||||
<CommandContainer />
|
||||
</CacheProvider>
|
||||
<ErrorBoundary>
|
||||
<Switch>
|
||||
{userStore.isNewVersion && <Route component={WhatsNew}/>}
|
||||
<Route component={WhatsNew} {...whatsNewRoute}/>
|
||||
<Route component={ClusterManager}/>
|
||||
</Switch>
|
||||
</ErrorBoundary>
|
||||
<Notifications/>
|
||||
<ConfirmDialog/>
|
||||
<CommandContainer />
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user