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:
parent
c253637594
commit
998416f541
@ -81,8 +81,6 @@ describe("user store tests", () => {
|
|||||||
it("correctly resets theme to default value", async () => {
|
it("correctly resets theme to default value", async () => {
|
||||||
const us = UserStore.getInstance();
|
const us = UserStore.getInstance();
|
||||||
|
|
||||||
us.isLoaded = true;
|
|
||||||
|
|
||||||
us.colorTheme = "some other theme";
|
us.colorTheme = "some other theme";
|
||||||
await us.resetTheme();
|
await us.resetTheme();
|
||||||
expect(us.colorTheme).toBe(UserStore.defaultTheme);
|
expect(us.colorTheme).toBe(UserStore.defaultTheme);
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import path from "path";
|
|||||||
import Config from "conf";
|
import Config from "conf";
|
||||||
import type { Options as ConfOptions } from "conf/dist/source/types";
|
import type { Options as ConfOptions } from "conf/dist/source/types";
|
||||||
import { app, ipcMain, ipcRenderer, remote } from "electron";
|
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 { getAppVersion, Singleton, toJS, Disposer } from "./utils";
|
||||||
import logger from "../main/logger";
|
import logger from "../main/logger";
|
||||||
import { broadcastMessage, ipcMainOn, ipcRendererOn } from "./ipc";
|
import { broadcastMessage, ipcMainOn, ipcRendererOn } from "./ipc";
|
||||||
@ -40,12 +40,6 @@ export abstract class BaseStore<T> extends Singleton {
|
|||||||
protected storeConfig?: Config<T>;
|
protected storeConfig?: Config<T>;
|
||||||
protected syncDisposers: Disposer[] = [];
|
protected syncDisposers: Disposer[] = [];
|
||||||
|
|
||||||
@observable isLoaded = false;
|
|
||||||
|
|
||||||
get whenLoaded() {
|
|
||||||
return when(() => this.isLoaded);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected constructor(protected params: BaseStoreParams<T>) {
|
protected constructor(protected params: BaseStoreParams<T>) {
|
||||||
super();
|
super();
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
@ -64,8 +58,6 @@ export abstract class BaseStore<T> extends Singleton {
|
|||||||
|
|
||||||
logger.info(`[STORE]: LOADED from ${this.path}`);
|
logger.info(`[STORE]: LOADED from ${this.path}`);
|
||||||
this.fromStore(this.storeConfig.store);
|
this.fromStore(this.storeConfig.store);
|
||||||
this.isLoaded = true;
|
|
||||||
|
|
||||||
this.enableSync();
|
this.enableSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ export class ExtensionLoader extends Singleton {
|
|||||||
if (this.instancesByName.has(change.newValue.name)) {
|
if (this.instancesByName.has(change.newValue.name)) {
|
||||||
throw new TypeError("Extension names must be unique");
|
throw new TypeError("Extension names must be unique");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.instancesByName.set(change.newValue.name, change.newValue);
|
this.instancesByName.set(change.newValue.name, change.newValue);
|
||||||
break;
|
break;
|
||||||
case "delete":
|
case "delete":
|
||||||
@ -124,7 +124,7 @@ export class ExtensionLoader extends Singleton {
|
|||||||
await this.initMain();
|
await this.initMain();
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all([this.whenLoaded, ExtensionsStore.getInstance().whenLoaded]);
|
await Promise.all([this.whenLoaded]);
|
||||||
|
|
||||||
// broadcasting extensions between main/renderer processes
|
// broadcasting extensions between main/renderer processes
|
||||||
reaction(() => this.toJSON(), () => this.broadcastExtensions(), {
|
reaction(() => this.toJSON(), () => this.broadcastExtensions(), {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user