Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Commit

Permalink
Add fix for GraphManager needing MainWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
ArmandKrynauw committed Jul 29, 2023
1 parent 7acb2e0 commit ec7ddba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/electron/lib/Blix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 4 additions & 2 deletions src/electron/lib/core-graph/CoreGraphManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ import type { QueryResponse } from "../../../shared/types";
export class CoreGraphManager {
private _graphs: { [id: UUID]: CoreGraph };
private _subscribers: { [key: UUID]: CoreGraphSubscriber<any>[] };
private readonly _mainWindow: MainWindow | undefined;

constructor() {
constructor(mainWindow?: MainWindow) {
this._graphs = {};
this._subscribers = {};
this._mainWindow = mainWindow;
}

addGraph(coreGraph: CoreGraph) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ec7ddba

Please sign in to comment.