Skip to content

Commit

Permalink
fix updateInheritance & persistence bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mstdokumaci committed Sep 6, 2019
1 parent dd2f8b9 commit decff4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/extendable-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ export default class ExtendableSet extends Set {
}

updateInheritance (inherits) {
super.forEach(item => {
if (inherits.has(item)) {
super.delete(item)
}
})
if (this.inherits) {
this.inherits.extenders.delete(this)
}
if (inherits) {
inherits.forEach(value => {
if (!super.delete(value) && this.extenders.size) {
this.deleteFromExtenders(value)
}
})
inherits.extenders.add(this)
}
this.inherits = inherits
inherits.extenders.add(this)
}
}
2 changes: 1 addition & 1 deletion src/persist.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const bindAllDataListener = (branch, persist) => {
}

branch.listeners.allData.persist = (type, _, item) => {
if (type !== 'remove' && item.id in branch.leaves) {
if (type !== 'remove' && Object.prototype.hasOwnProperty.call(branch.leaves, item.id)) {
const leaf = branch.leaves[item.id]
persist.store(
String(item.id),
Expand Down

0 comments on commit decff4b

Please sign in to comment.