mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Convert all renderer runnables to late-inject style
- To help fix issues around injection time Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
83bb5c37d9
commit
c68a1bfd04
16 files changed
+159
-191
No files matched your search
@@ -10,22 +10,19 @@ import requestInitialClusterStatesInjectable from "./request-initial.injectable"
|
||||
|
||||
const setupClusterStateSyncInjectable = getInjectable({
|
||||
id: "setup-cluster-state-sync",
|
||||
instantiate: (di) => {
|
||||
const requestInitialClusterStates = di.inject(requestInitialClusterStatesInjectable);
|
||||
const getClusterById = di.inject(getClusterByIdInjectable);
|
||||
instantiate: (di) => ({
|
||||
id: "setup-cluster-state-sync",
|
||||
run: async () => {
|
||||
const requestInitialClusterStates = di.inject(requestInitialClusterStatesInjectable);
|
||||
const getClusterById = di.inject(getClusterByIdInjectable);
|
||||
const initalStates = await requestInitialClusterStates();
|
||||
|
||||
return {
|
||||
id: "setup-cluster-state-sync",
|
||||
run: async () => {
|
||||
const initalStates = await requestInitialClusterStates();
|
||||
|
||||
for (const { clusterId, state } of initalStates) {
|
||||
getClusterById(clusterId)?.setState(state);
|
||||
}
|
||||
},
|
||||
runAfter: di.inject(initClusterStoreInjectable),
|
||||
};
|
||||
},
|
||||
for (const { clusterId, state } of initalStates) {
|
||||
getClusterById(clusterId)?.setState(state);
|
||||
}
|
||||
},
|
||||
runAfter: di.inject(initClusterStoreInjectable),
|
||||
}),
|
||||
injectionToken: beforeFrameStartsInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@@ -9,17 +9,15 @@ import initUserStoreInjectable from "../../../../renderer/stores/init-user-store
|
||||
|
||||
const initClusterStoreInjectable = getInjectable({
|
||||
id: "init-cluster-store",
|
||||
instantiate: (di) => {
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
instantiate: (di) => ({
|
||||
id: "init-cluster-store",
|
||||
run: () => {
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
|
||||
return {
|
||||
id: "init-cluster-store",
|
||||
run: () => {
|
||||
clusterStore.load();
|
||||
},
|
||||
runAfter: di.inject(initUserStoreInjectable),
|
||||
};
|
||||
},
|
||||
clusterStore.load();
|
||||
},
|
||||
runAfter: di.inject(initUserStoreInjectable),
|
||||
}),
|
||||
injectionToken: beforeFrameStartsInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@@ -9,17 +9,15 @@ import initClusterStoreInjectable from "../../../cluster/store/renderer/init.inj
|
||||
|
||||
const initHotbarStoreInjectable = getInjectable({
|
||||
id: "init-hotbar-store",
|
||||
instantiate: (di) => {
|
||||
const hotbarStore = di.inject(hotbarStoreInjectable);
|
||||
instantiate: (di) => ({
|
||||
id: "init-hotbar-store",
|
||||
run: () => {
|
||||
const hotbarStore = di.inject(hotbarStoreInjectable);
|
||||
|
||||
return {
|
||||
id: "init-hotbar-store",
|
||||
run: () => {
|
||||
hotbarStore.load();
|
||||
},
|
||||
runAfter: di.inject(initClusterStoreInjectable),
|
||||
};
|
||||
},
|
||||
hotbarStore.load();
|
||||
},
|
||||
runAfter: di.inject(initClusterStoreInjectable),
|
||||
}),
|
||||
injectionToken: beforeFrameStartsInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@@ -10,18 +10,16 @@ import requestInitialSystemThemeTypeInjectable from "./request-initial.injectabl
|
||||
|
||||
const initializeSystemThemeTypeInjectable = getInjectable({
|
||||
id: "initialize-system-theme-type",
|
||||
instantiate: (di) => {
|
||||
const systemThemeConfiguration = di.inject(systemThemeConfigurationInjectable);
|
||||
const requestInitialSystemThemeType = di.inject(requestInitialSystemThemeTypeInjectable);
|
||||
instantiate: (di) => ({
|
||||
id: "initialize-system-theme-type",
|
||||
run: async () => {
|
||||
const systemThemeConfiguration = di.inject(systemThemeConfigurationInjectable);
|
||||
const requestInitialSystemThemeType = di.inject(requestInitialSystemThemeTypeInjectable);
|
||||
|
||||
return {
|
||||
id: "initialize-system-theme-type",
|
||||
run: async () => {
|
||||
systemThemeConfiguration.set(await requestInitialSystemThemeType());
|
||||
},
|
||||
runAfter: di.inject(initUserStoreInjectable),
|
||||
};
|
||||
},
|
||||
systemThemeConfiguration.set(await requestInitialSystemThemeType());
|
||||
},
|
||||
runAfter: di.inject(initUserStoreInjectable),
|
||||
}),
|
||||
injectionToken: beforeFrameStartsInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user