Use multiple runAfter support to fix crash on renderer

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2022-12-06 09:18:59 -05:00
1 parent 5b80dfc70a
commit ed99f24420
1 file changed
+13 -8
@@ -4,20 +4,25 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import userStoreInjectable from "../../common/user-store/user-store.injectable";
import setupAppPathsInjectable from "../app-paths/setup-app-paths.injectable";
import { beforeFrameStartsInjectionToken } from "../before-frame-starts/before-frame-starts-injection-token";
import initDefaultUpdateChannelInjectable from "../vars/default-update-channel/init.injectable";
const initUserStoreInjectable = getInjectable({
id: "init-user-store",
instantiate: (di) => {
const userStore = di.inject(userStoreInjectable);
instantiate: (di) => ({
id: "init-user-store",
run: () => {
// This must be done here so as to actually only be instantiated after the dependencies are
const userStore = di.inject(userStoreInjectable);
return {
id: "init-user-store",
run: () => userStore.load(),
runAfter: di.inject(initDefaultUpdateChannelInjectable),
};
},
return userStore.load();
},
runAfter: [
di.inject(initDefaultUpdateChannelInjectable),
di.inject(setupAppPathsInjectable),
],
}),
injectionToken: beforeFrameStartsInjectionToken,
});