mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix crash on clean startup (#6276)
* Convert ReleaseChannel into an InitializableState Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix init timing for DefaultUpdateChannel Signed-off-by: Sebastian Malton <sebastian@malton.name> * Make UserStore loading seperate from creation to fix initialization timing errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix overrides of UserStore Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix UserStore tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move userStoreFileMigration call to the init runnable Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add global override for userStoreFileMigratiom Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
dad6dcacda
commit
4c49134dbc
18 files changed
+159
-49
No files matched your search
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 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 userStoreFileNameMigrationInjectable from "../../common/user-store/file-name-migration.injectable";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
||||
import initDefaultUpdateChannelInjectableInjectable from "../vars/default-update-channel/init.injectable";
|
||||
|
||||
const initUserStoreInjectable = getInjectable({
|
||||
id: "init-user-store",
|
||||
instantiate: (di) => {
|
||||
const userStore = di.inject(userStoreInjectable);
|
||||
const userStoreFileNameMigration = di.inject(userStoreFileNameMigrationInjectable);
|
||||
|
||||
return {
|
||||
run: async () => {
|
||||
await userStoreFileNameMigration();
|
||||
userStore.load();
|
||||
},
|
||||
runAfter: di.inject(initDefaultUpdateChannelInjectableInjectable),
|
||||
};
|
||||
},
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
export default initUserStoreInjectable;
|
||||
Reference in new issue
Block a user