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

fix: Catalog is empty after closing main-window and re-opening app from Tray

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2021-05-17 15:16:36 +03:00
parent 542194c609
commit 01968505e7
3 changed files with 8 additions and 8 deletions

View File

@ -21,8 +21,10 @@
import { action, computed, IComputedValue, IObservableArray, makeObservable, observable } from "mobx";
import { CatalogEntity } from "./catalog-entity";
import logger from "../../main/logger";
export class CatalogEntityRegistry {
private logPrefix = `[CatalogEntityRegistry]`;
protected sources = observable.map<string, IComputedValue<CatalogEntity[]>>();
constructor() {
@ -31,6 +33,8 @@ export class CatalogEntityRegistry {
@action
addObservableSource(id: string, source: IObservableArray<CatalogEntity> | IComputedValue<CatalogEntity[]>) {
logger.debug(`${this.logPrefix}: adding observable source with id="${id}"`);
if (Array.isArray(source)) {
this.sources.set(id, computed(() => source.toJSON()));
} else {

View File

@ -144,7 +144,6 @@ app.on("ready", async () => {
const lensProxy = LensProxy.createInstance(handleWsUpgrade);
ClusterManager.createInstance();
KubeconfigSyncManager.createInstance().startSync();
try {
logger.info("🔌 Starting LensProxy");
@ -189,17 +188,14 @@ app.on("ready", async () => {
}
ipcMain.on(IpcRendererNavigationEvents.LOADED, () => {
KubeconfigSyncManager.createInstance().startSync();
CatalogPusher.init(catalogEntityRegistry);
startUpdateChecking();
LensProtocolRouterMain
.getInstance()
.rendererLoaded = true;
LensProtocolRouterMain.getInstance().rendererLoaded = true;
});
ExtensionLoader.getInstance().whenLoaded.then(() => {
LensProtocolRouterMain
.getInstance()
.extensionsLoaded = true;
LensProtocolRouterMain.getInstance().extensionsLoaded = true;
});
logger.info("🧩 Initializing extensions");

View File

@ -35,7 +35,7 @@ export class CatalogEntityRegistry {
init() {
subscribeToBroadcast("catalog:items", (event, items: (CatalogEntityData & CatalogEntityKindData)[]) => {
logger.info(`[CatalogEntityRegistry]: received new catalog items`, items);
logger.debug(`[CatalogEntityRegistry]: received new catalog items`, { items });
this.updateItems(items);
});
broadcastMessage("catalog:broadcast");