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:
parent
542194c609
commit
01968505e7
@ -21,8 +21,10 @@
|
|||||||
|
|
||||||
import { action, computed, IComputedValue, IObservableArray, makeObservable, observable } from "mobx";
|
import { action, computed, IComputedValue, IObservableArray, makeObservable, observable } from "mobx";
|
||||||
import { CatalogEntity } from "./catalog-entity";
|
import { CatalogEntity } from "./catalog-entity";
|
||||||
|
import logger from "../../main/logger";
|
||||||
|
|
||||||
export class CatalogEntityRegistry {
|
export class CatalogEntityRegistry {
|
||||||
|
private logPrefix = `[CatalogEntityRegistry]`;
|
||||||
protected sources = observable.map<string, IComputedValue<CatalogEntity[]>>();
|
protected sources = observable.map<string, IComputedValue<CatalogEntity[]>>();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -31,6 +33,8 @@ export class CatalogEntityRegistry {
|
|||||||
|
|
||||||
@action
|
@action
|
||||||
addObservableSource(id: string, source: IObservableArray<CatalogEntity> | IComputedValue<CatalogEntity[]>) {
|
addObservableSource(id: string, source: IObservableArray<CatalogEntity> | IComputedValue<CatalogEntity[]>) {
|
||||||
|
logger.debug(`${this.logPrefix}: adding observable source with id="${id}"`);
|
||||||
|
|
||||||
if (Array.isArray(source)) {
|
if (Array.isArray(source)) {
|
||||||
this.sources.set(id, computed(() => source.toJSON()));
|
this.sources.set(id, computed(() => source.toJSON()));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -144,7 +144,6 @@ app.on("ready", async () => {
|
|||||||
const lensProxy = LensProxy.createInstance(handleWsUpgrade);
|
const lensProxy = LensProxy.createInstance(handleWsUpgrade);
|
||||||
|
|
||||||
ClusterManager.createInstance();
|
ClusterManager.createInstance();
|
||||||
KubeconfigSyncManager.createInstance().startSync();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.info("🔌 Starting LensProxy");
|
logger.info("🔌 Starting LensProxy");
|
||||||
@ -189,17 +188,14 @@ app.on("ready", async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ipcMain.on(IpcRendererNavigationEvents.LOADED, () => {
|
ipcMain.on(IpcRendererNavigationEvents.LOADED, () => {
|
||||||
|
KubeconfigSyncManager.createInstance().startSync();
|
||||||
CatalogPusher.init(catalogEntityRegistry);
|
CatalogPusher.init(catalogEntityRegistry);
|
||||||
startUpdateChecking();
|
startUpdateChecking();
|
||||||
LensProtocolRouterMain
|
LensProtocolRouterMain.getInstance().rendererLoaded = true;
|
||||||
.getInstance()
|
|
||||||
.rendererLoaded = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ExtensionLoader.getInstance().whenLoaded.then(() => {
|
ExtensionLoader.getInstance().whenLoaded.then(() => {
|
||||||
LensProtocolRouterMain
|
LensProtocolRouterMain.getInstance().extensionsLoaded = true;
|
||||||
.getInstance()
|
|
||||||
.extensionsLoaded = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info("🧩 Initializing extensions");
|
logger.info("🧩 Initializing extensions");
|
||||||
|
|||||||
@ -35,7 +35,7 @@ export class CatalogEntityRegistry {
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
subscribeToBroadcast("catalog:items", (event, items: (CatalogEntityData & CatalogEntityKindData)[]) => {
|
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);
|
this.updateItems(items);
|
||||||
});
|
});
|
||||||
broadcastMessage("catalog:broadcast");
|
broadcastMessage("catalog:broadcast");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user