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

Remove BaseStore.isLoaded

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-06-24 14:00:05 -04:00
parent c253637594
commit 998416f541
3 changed files with 3 additions and 13 deletions

View File

@ -81,8 +81,6 @@ describe("user store tests", () => {
it("correctly resets theme to default value", async () => {
const us = UserStore.getInstance();
us.isLoaded = true;
us.colorTheme = "some other theme";
await us.resetTheme();
expect(us.colorTheme).toBe(UserStore.defaultTheme);

View File

@ -23,7 +23,7 @@ import path from "path";
import Config from "conf";
import type { Options as ConfOptions } from "conf/dist/source/types";
import { app, ipcMain, ipcRenderer, remote } from "electron";
import { IReactionOptions, makeObservable, observable, reaction, runInAction, when } from "mobx";
import { IReactionOptions, makeObservable, reaction, runInAction } from "mobx";
import { getAppVersion, Singleton, toJS, Disposer } from "./utils";
import logger from "../main/logger";
import { broadcastMessage, ipcMainOn, ipcRendererOn } from "./ipc";
@ -40,12 +40,6 @@ export abstract class BaseStore<T> extends Singleton {
protected storeConfig?: Config<T>;
protected syncDisposers: Disposer[] = [];
@observable isLoaded = false;
get whenLoaded() {
return when(() => this.isLoaded);
}
protected constructor(protected params: BaseStoreParams<T>) {
super();
makeObservable(this);
@ -64,8 +58,6 @@ export abstract class BaseStore<T> extends Singleton {
logger.info(`[STORE]: LOADED from ${this.path}`);
this.fromStore(this.storeConfig.store);
this.isLoaded = true;
this.enableSync();
}

View File

@ -77,7 +77,7 @@ export class ExtensionLoader extends Singleton {
if (this.instancesByName.has(change.newValue.name)) {
throw new TypeError("Extension names must be unique");
}
this.instancesByName.set(change.newValue.name, change.newValue);
break;
case "delete":
@ -124,7 +124,7 @@ export class ExtensionLoader extends Singleton {
await this.initMain();
}
await Promise.all([this.whenLoaded, ExtensionsStore.getInstance().whenLoaded]);
await Promise.all([this.whenLoaded]);
// broadcasting extensions between main/renderer processes
reaction(() => this.toJSON(), () => this.broadcastExtensions(), {