Skip to content

Commit

Permalink
Merge pull request #15 from asimgunes/bugfix/duplicate-register-nodes
Browse files Browse the repository at this point in the history
Bugfix for duplicate insertation of registers while extending new file providers
  • Loading branch information
thegecko authored Dec 11, 2023
2 parents 77d180e + 7369dfd commit 8404ea1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/views/nodes/peripheralclusternode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ export class PeripheralClusterNode extends ClusterOrRegisterBaseNode {
this.parent.addChild(this);

options.clusters?.forEach((clusterOptions) => {
const cluster = new PeripheralClusterNode(this, clusterOptions);
this.addChild(cluster);
// PeripheralClusterNode constructor already adding the reference as child to parent object (PeripheralClusterNode object)
new PeripheralClusterNode(this, clusterOptions);
});

options.registers?.forEach((registerOptions) => {
const register = new PeripheralRegisterNode(this, registerOptions);
this.addChild(register);
// PeripheralRegisterNode constructor already adding the reference as child to parent object (PeripheralClusterNode object)
new PeripheralRegisterNode(this, registerOptions);
});
}

Expand Down
8 changes: 4 additions & 4 deletions src/views/nodes/peripheralnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ export class PeripheralNode extends PeripheralBaseNode {
this.addrRanges = [];

options.clusters?.forEach((clusterOptions) => {
const cluster = new PeripheralClusterNode(this, clusterOptions);
this.addChild(cluster);
// PeripheralClusterNode constructor already adding the reference as child to parent object (PeripheralNode object)
new PeripheralClusterNode(this, clusterOptions);
});

options.registers?.forEach((registerOptions) => {
const register = new PeripheralRegisterNode(this, registerOptions);
this.addChild(register);
// PeripheralRegisterNode constructor already adding the reference as child to parent object (PeripheralNode object)
new PeripheralRegisterNode(this, registerOptions);
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/views/nodes/peripheralregisternode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export class PeripheralRegisterNode extends ClusterOrRegisterBaseNode {
this.parent.addChild(this);

options.fields?.forEach((fieldOptions) => {
this.addChild(new PeripheralFieldNode(this, fieldOptions));
// PeripheralFieldNode constructor already adding the reference as child to parent object (PeripheralRegisterNode object)
new PeripheralFieldNode(this, fieldOptions);
});
}

Expand Down

0 comments on commit 8404ea1

Please sign in to comment.