diff --git a/src/common/hotbar-store.ts b/src/common/hotbar-store.ts index abbae0e1b0..f3f954b499 100644 --- a/src/common/hotbar-store.ts +++ b/src/common/hotbar-store.ts @@ -44,8 +44,8 @@ export class HotbarStore extends BaseStore { }, migrations, }); + makeObservable(this); - this.load(); } @computed get activeHotbarId() { diff --git a/src/main/start-main-application/after-application-is-ready/implementations/setup-hotbar-store.injectable.ts b/src/main/start-main-application/after-application-is-ready/implementations/setup-hotbar-store.injectable.ts new file mode 100644 index 0000000000..1bce3e7e2c --- /dev/null +++ b/src/main/start-main-application/after-application-is-ready/implementations/setup-hotbar-store.injectable.ts @@ -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 { afterApplicationIsReadyInjectionToken } from "../after-application-is-ready-injection-token"; +import hotbarStoreInjectable from "../../../../common/hotbar-store.injectable"; +import setupSyncingOfGeneralCatalogEntitiesInjectable from "./setup-syncing-of-general-catalog-entities.injectable"; + +const setupHotbarStoreInjectable = getInjectable({ + id: "setup-hotbar-store", + + instantiate: (di) => ({ + run: () => { + const hotbarStore = di.inject(hotbarStoreInjectable); + + hotbarStore.load(); + }, + + runAfter: di.inject(setupSyncingOfGeneralCatalogEntitiesInjectable), + }), + + injectionToken: afterApplicationIsReadyInjectionToken, +}); + +export default setupHotbarStoreInjectable; diff --git a/src/renderer/bootstrap.tsx b/src/renderer/bootstrap.tsx index 7e5a6ea548..326150b2b1 100644 --- a/src/renderer/bootstrap.tsx +++ b/src/renderer/bootstrap.tsx @@ -122,7 +122,7 @@ export async function bootstrap(di: DiContainer) { await clusterStore.loadInitialOnRenderer(); // HotbarStore depends on: ClusterStore - di.inject(hotbarStoreInjectable); + di.inject(hotbarStoreInjectable).load(); // ThemeStore depends on: UserStore // TODO: Remove temporal dependencies