From 7989015b4ff356bc2a36cdb3f90e00c0e2e7db39 Mon Sep 17 00:00:00 2001 From: "bigopon.777@gmail.com" Date: Thu, 28 Dec 2017 09:36:08 +1100 Subject: [PATCH] fix(child-observation): unset property in unbind --- src/child-observation.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/child-observation.js b/src/child-observation.js index fc8525eb..81b32673 100644 --- a/src/child-observation.js +++ b/src/child-observation.js @@ -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) { @@ -273,6 +275,7 @@ class ChildObserverBinder { if (this.viewHost.__childObserver__) { this.viewHost.__childObserver__.disconnect(); this.viewHost.__childObserver__ = null; + this.viewModel[this.property] = null; } } }