Skip to content

Commit

Permalink
Merge pull request #383 from yojeek/patch-1
Browse files Browse the repository at this point in the history
Cleanup old templates when loading new Graph into editor
  • Loading branch information
newcat authored Feb 18, 2024
2 parents 1f407bb + 9b7e17a commit 0f1e96a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/core/src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ export class Editor implements IBaklavaEventEmitter, IBaklavaTapable {
this._loading = true;
state = this.hooks.load.execute(state);

while (this.graphTemplates.length > 0) {
this.removeGraphTemplate(this.graphTemplates[0]);
}

state.graphTemplates.forEach((tState) => {
const template = new GraphTemplate(tState, this);
this.addGraphTemplate(template);
Expand Down

0 comments on commit 0f1e96a

Please sign in to comment.