diff --git a/src/electron/lib/Blix.ts b/src/electron/lib/Blix.ts index 6cb19473..9774bb26 100644 --- a/src/electron/lib/Blix.ts +++ b/src/electron/lib/Blix.ts @@ -76,7 +76,7 @@ export class Blix { this._pluginManager = new PluginManager(this); await this._pluginManager.loadBasePlugins(); - this._graphManager = new CoreGraphManager(); + this._graphManager = new CoreGraphManager(mainWindow); this._projectManager = new ProjectManager(mainWindow); this.initSubscribers(); diff --git a/src/electron/lib/core-graph/CoreGraphManager.ts b/src/electron/lib/core-graph/CoreGraphManager.ts index f3d529b3..33e6e7a1 100644 --- a/src/electron/lib/core-graph/CoreGraphManager.ts +++ b/src/electron/lib/core-graph/CoreGraphManager.ts @@ -18,10 +18,12 @@ import type { QueryResponse } from "../../../shared/types"; export class CoreGraphManager { private _graphs: { [id: UUID]: CoreGraph }; private _subscribers: { [key: UUID]: CoreGraphSubscriber[] }; + private readonly _mainWindow: MainWindow | undefined; - constructor() { + constructor(mainWindow?: MainWindow) { this._graphs = {}; this._subscribers = {}; + this._mainWindow = mainWindow; } addGraph(coreGraph: CoreGraph) { @@ -103,7 +105,7 @@ export class CoreGraphManager { if (uuid in this._graphs) { delete this._graphs[uuid]; delete this._subscribers[uuid]; - this._mainWindow.apis.graphClientApi.graphRemoved(uuid); + this._mainWindow?.apis.graphClientApi.graphRemoved(uuid); flags.push(true); } else { flags.push(false);