Skip to content

Commit

Permalink
feat: ContainerEntity upsert should return the previous attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed Jan 5, 2023
1 parent 68e6d35 commit 38ccba5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/lib/entities/ContainerEntity.js
Expand Up @@ -268,11 +268,15 @@ class ContainerEntity extends SerializableEntity {
if (index === -1) {
this.attributes.push(newAttribute);
this.notifySubscribers(EVENT_TYPE.ADD, newAttribute);

return null;
} else {
const previousAttribute = this.attributes[index];

this.attributes[index] = newAttribute;
this.notifySubscribers(EVENT_TYPE.CHANGE, newAttribute, previousAttribute);

return previousAttribute;
}
}

Expand Down

0 comments on commit 38ccba5

Please sign in to comment.