mirror of
https://github.com/Egonex-AI/Understand-Anything.git
synced 2026-06-22 10:58:03 +08:00
refactor: return shallow copies of nodes and edges from build()
build() was returning direct references to the builder's internal arrays, allowing callers to mutate graph.nodes or graph.edges and corrupt the builder's state. Spreading into new arrays at build time prevents this at negligible cost.
This commit is contained in:
@@ -412,8 +412,8 @@ export class GraphBuilder {
|
||||
analyzedAt: new Date().toISOString(),
|
||||
gitCommitHash: this.gitHash,
|
||||
},
|
||||
nodes: this.nodes,
|
||||
edges: this.edges,
|
||||
nodes: [...this.nodes],
|
||||
edges: [...this.edges],
|
||||
layers: [],
|
||||
tour: [],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user