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

Fix HotbarStore.load being called twice is being buggy

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-12-05 14:32:38 -05:00
parent 618d0d83b5
commit ca49e585e7
3 changed files with 5 additions and 32 deletions

View File

@ -100,7 +100,7 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
this._activeHotbarId = data.activeHotbarId;
}
if (!this.activeHotbarId) {
if (!this._activeHotbarId) {
this._activeHotbarId = this.hotbars[0].id;
}
}

View File

@ -4,8 +4,8 @@
*/
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";
import { onLoadOfApplicationInjectionToken } from "../../../../main/start-main-application/runnable-tokens/on-load-of-application-injection-token";
import setupSyncingOfGeneralCatalogEntitiesInjectable from "../../../../main/start-main-application/runnables/setup-syncing-of-general-catalog-entities.injectable";
const initHotbarStoreInjectable = getInjectable({
id: "init-hotbar-store",
@ -17,10 +17,10 @@ const initHotbarStoreInjectable = getInjectable({
run: () => {
hotbarStore.load();
},
runAfter: di.inject(initClusterStoreInjectable),
runAfter: di.inject(setupSyncingOfGeneralCatalogEntitiesInjectable),
};
},
injectionToken: beforeApplicationIsLoadingInjectionToken,
injectionToken: onLoadOfApplicationInjectionToken,
});
export default initHotbarStoreInjectable;

View File

@ -1,27 +0,0 @@
/**
* 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 setupSyncingOfGeneralCatalogEntitiesInjectable from "./setup-syncing-of-general-catalog-entities.injectable";
import { onLoadOfApplicationInjectionToken } from "../runnable-tokens/on-load-of-application-injection-token";
import hotbarStoreInjectable from "../../../common/hotbars/store.injectable";
const setupHotbarStoreInjectable = getInjectable({
id: "setup-hotbar-store",
instantiate: (di) => ({
id: "setup-hotbar-store",
run: () => {
const hotbarStore = di.inject(hotbarStoreInjectable);
hotbarStore.load();
},
runAfter: di.inject(setupSyncingOfGeneralCatalogEntitiesInjectable),
}),
injectionToken: onLoadOfApplicationInjectionToken,
});
export default setupHotbarStoreInjectable;