From 01968505e7079b1827f2d565d64efe1f94d7c182 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 17 May 2021 15:16:36 +0300 Subject: [PATCH] fix: Catalog is empty after closing main-window and re-opening app from Tray Signed-off-by: Roman --- src/common/catalog/catalog-entity-registry.ts | 4 ++++ src/main/index.ts | 10 +++------- src/renderer/api/catalog-entity-registry.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/catalog/catalog-entity-registry.ts b/src/common/catalog/catalog-entity-registry.ts index 793c49055c..b7e7e8e307 100644 --- a/src/common/catalog/catalog-entity-registry.ts +++ b/src/common/catalog/catalog-entity-registry.ts @@ -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>(); constructor() { @@ -31,6 +33,8 @@ export class CatalogEntityRegistry { @action addObservableSource(id: string, source: IObservableArray | IComputedValue) { + logger.debug(`${this.logPrefix}: adding observable source with id="${id}"`); + if (Array.isArray(source)) { this.sources.set(id, computed(() => source.toJSON())); } else { diff --git a/src/main/index.ts b/src/main/index.ts index a7a85c0e02..b992c50abc 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -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"); diff --git a/src/renderer/api/catalog-entity-registry.ts b/src/renderer/api/catalog-entity-registry.ts index f1d96fb868..ec537c4fc1 100644 --- a/src/renderer/api/catalog-entity-registry.ts +++ b/src/renderer/api/catalog-entity-registry.ts @@ -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");