Skip to content

Commit 3bc8ef8

Browse files
committed
update modelData before node / link data in Diagram/Palette init
1 parent a63c7e1 commit 3bc8ef8

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

projects/gojs-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gojs-angular",
3-
"version": "1.0.19",
3+
"version": "1.0.20",
44
"peerDependencies": {
55
"@angular/common": ">=11.0.0",
66
"@angular/core": ">=11.0.0"

projects/gojs-angular/src/lib/diagram.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ export class DiagramComponent {
8585
this.diagram.delayInitialization(() => {
8686
const model = this.diagram.model;
8787
model.commit((m: go.Model) => {
88+
if (this.modelData) {
89+
m.assignAllDataProperties(m.modelData, this.modelData);
90+
}
8891
m.mergeNodeDataArray(m.cloneDeep(this.nodeDataArray));
8992
if (this.linkDataArray && m instanceof go.GraphLinksModel) {
9093
m.mergeLinkDataArray(m.cloneDeep(this.linkDataArray));
9194
}
92-
if (this.modelData) {
93-
m.assignAllDataProperties(m.modelData, this.modelData);
94-
}
9595
}, null);
9696
});
9797

projects/gojs-angular/src/lib/palette.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ export class PaletteComponent {
8787
this.palette.delayInitialization(() => {
8888
const model = this.palette.model;
8989
model.commit((m: go.Model) => {
90+
if (this.modelData) {
91+
m.assignAllDataProperties(m.modelData, this.modelData);
92+
}
9093
m.mergeNodeDataArray(m.cloneDeep(this.nodeDataArray));
9194
if (this.linkDataArray && m instanceof go.GraphLinksModel) {
9295
m.mergeLinkDataArray(m.cloneDeep(this.linkDataArray));
9396
}
94-
if (this.modelData) {
95-
m.assignAllDataProperties(m.modelData, this.modelData);
96-
}
9797
}, null);
9898
});
9999

@@ -121,7 +121,7 @@ export class PaletteComponent {
121121

122122
// these need to be run each check, even if no merging happens
123123
// otherwise, they will detect all diffs that happened since last time skipsPaletteUpdate was false,
124-
// such as remove ops that happened in GoJS when skipsPaletteUpdate = true,
124+
// such as remove ops that happened in GoJS when skipsPaletteUpdate = true,
125125
// and then realllllly bad stuff happens (deleting random nodes, updating the wrong Parts)
126126
// Angular differs are a lot of fun
127127
var nodeDiffs = this._ndaDiffer.diff(this.nodeDataArray);

0 commit comments

Comments
 (0)