Make injecting legacy singleton always provide new instance

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen committed 2022-03-31 15:13:32 +03:00
1 parent 39795d8f35
commit 76101023df
4 files changed
+28 -4

No files matched your search

@@ -7,7 +7,13 @@ import { UserStore } from "./user-store";
const userStoreInjectable = getInjectable({ const userStoreInjectable = getInjectable({
id: "user-store", id: "user-store",
instantiate: () => UserStore.createInstance(),
instantiate: () => {
UserStore.resetInstance();
return UserStore.createInstance();
},
causesSideEffects: true, causesSideEffects: true,
}); });
@@ -7,7 +7,13 @@ import { ExtensionsStore } from "./extensions-store";
const extensionsStoreInjectable = getInjectable({ const extensionsStoreInjectable = getInjectable({
id: "extensions-store", id: "extensions-store",
instantiate: () => ExtensionsStore.createInstance(),
instantiate: () => {
ExtensionsStore.resetInstance();
return ExtensionsStore.createInstance();
},
causesSideEffects: true, causesSideEffects: true,
}); });
+7 -1
View File
@@ -7,7 +7,13 @@ import { WindowManager } from "./window-manager";
const windowManagerInjectable = getInjectable({ const windowManagerInjectable = getInjectable({
id: "window-manager", id: "window-manager",
instantiate: () => WindowManager.createInstance(),
instantiate: () => {
WindowManager.resetInstance();
return WindowManager.createInstance();
},
causesSideEffects: true, causesSideEffects: true,
}); });
+7 -1
View File
@@ -7,7 +7,13 @@ import { ThemeStore } from "./theme.store";
const themeStoreInjectable = getInjectable({ const themeStoreInjectable = getInjectable({
id: "theme-store", id: "theme-store",
instantiate: () => ThemeStore.createInstance(),
instantiate: () => {
ThemeStore.resetInstance();
return ThemeStore.createInstance();
},
causesSideEffects: true, causesSideEffects: true,
}); });