Skip to content

Commit

Permalink
Merge pull request #593 from bigopon/fix-child-children-deco
Browse files Browse the repository at this point in the history
fix(child-observation): unset property in unbind
  • Loading branch information
EisenbergEffect authored Jun 20, 2018
2 parents 5d0f0c1 + 7989015 commit 926f6e5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/child-observation.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ class ChildObserverBinder {
if (!items) {
items = viewModel[this.property] = [];
} else {
items.length = 0;
// The existing array may alread be observed in other bindings
// Setting length to 0 will not work properly, unless we intercept it
items.splice(0);
}

while (current) {
Expand Down Expand Up @@ -273,6 +275,7 @@ class ChildObserverBinder {
if (this.viewHost.__childObserver__) {
this.viewHost.__childObserver__.disconnect();
this.viewHost.__childObserver__ = null;
this.viewModel[this.property] = null;
}
}
}

0 comments on commit 926f6e5

Please sign in to comment.