Skip to content

Commit

Permalink
Fix for saving graph to file. Clone function did not make copies of e…
Browse files Browse the repository at this point in the history
…mbedded apps
  • Loading branch information
james-strauss-uwa committed Jan 15, 2024
1 parent 936d52e commit 0c9e041
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/LogicalGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ export class LogicalGraph {
const srcNode = graph.findNodeByKey(srcKey);
const destNode = graph.findNodeByKey(destKey);

// if source and destination node could not be found, skip edge
if (srcNode === null){
console.warn("Could not find edge (", srcKey, "->", destKey, ") source node by key (", srcKey, "), skipping");
continue;
}
if (destNode === null){
console.warn("Could not find edge (", srcKey, "->", destKey, ") destination node by key (", destKey, "), skipping");
continue;
}

// for OJS format, we actually store links using the node keys of the construct, not the node keys of the embedded applications
if (srcNode.isEmbedded()){
srcKey = srcNode.getEmbedKey();
Expand Down
7 changes: 7 additions & 0 deletions src/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,13 @@ export class Node {
result.paletteDownloadUrl(this.paletteDownloadUrl());
result.dataHash(this.dataHash());

if (this.hasInputApplication()){
result.inputApplication(this.inputApplication().clone());
}
if (this.hasOutputApplication()){
result.outputApplication(this.outputApplication().clone());
}

return result;
}

Expand Down

0 comments on commit 0c9e041

Please sign in to comment.