Skip to content

Commit

Permalink
fix(child-observation): unset property in unbind
Browse files Browse the repository at this point in the history
  • Loading branch information
bigopon committed Dec 27, 2017
1 parent 3f56b76 commit 7989015
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 7989015

Please sign in to comment.