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

Move init hotbar store into runnables

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-12-05 11:01:35 -05:00
parent f7b5ae7b57
commit 56c78c8c8b
3 changed files with 52 additions and 4 deletions

View File

@ -0,0 +1,26 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import hotbarStoreInjectable from "../../../../common/hotbars/store.injectable";
import { beforeApplicationIsLoadingInjectionToken } from "../../../../main/start-main-application/runnable-tokens/before-application-is-loading-injection-token";
import initClusterStoreInjectable from "../../../cluster/store/main/init.injectable";
const initHotbarStoreInjectable = getInjectable({
id: "init-hotbar-store",
instantiate: (di) => {
const hotbarStore = di.inject(hotbarStoreInjectable);
return {
id: "init-hotbar-store",
run: () => {
hotbarStore.load();
},
runAfter: di.inject(initClusterStoreInjectable),
};
},
injectionToken: beforeApplicationIsLoadingInjectionToken,
});
export default initHotbarStoreInjectable;

View File

@ -0,0 +1,26 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import hotbarStoreInjectable from "../../../../common/hotbars/store.injectable";
import { beforeFrameStartsInjectionToken } from "../../../../renderer/before-frame-starts/tokens";
import initClusterStoreInjectable from "../../../cluster/store/renderer/init.injectable";
const initHotbarStoreInjectable = getInjectable({
id: "init-hotbar-store",
instantiate: (di) => {
const hotbarStore = di.inject(hotbarStoreInjectable);
return {
id: "init-hotbar-store",
run: () => {
hotbarStore.load();
},
runAfter: di.inject(initClusterStoreInjectable),
};
},
injectionToken: beforeFrameStartsInjectionToken,
});
export default initHotbarStoreInjectable;

View File

@ -25,7 +25,6 @@ import initClusterFrameInjectable from "./frames/cluster-frame/init-cluster-fram
import { Router } from "react-router"; import { Router } from "react-router";
import historyInjectable from "./navigation/history.injectable"; import historyInjectable from "./navigation/history.injectable";
import themeStoreInjectable from "./themes/store.injectable"; import themeStoreInjectable from "./themes/store.injectable";
import hotbarStoreInjectable from "../common/hotbars/store.injectable";
import assert from "assert"; import assert from "assert";
import startFrameInjectable from "./start-frame/start-frame.injectable"; import startFrameInjectable from "./start-frame/start-frame.injectable";
@ -46,9 +45,6 @@ export async function bootstrap(di: DiContainer) {
extensionDiscovery.init(); extensionDiscovery.init();
// HotbarStore depends on: ClusterStore
di.inject(hotbarStoreInjectable).load();
// ThemeStore depends on: UserStore // ThemeStore depends on: UserStore
// TODO: Remove temporal dependencies // TODO: Remove temporal dependencies
di.inject(themeStoreInjectable); di.inject(themeStoreInjectable);