From e7ab9731e8d1a534a3ea5cad0a1d3c852510171d Mon Sep 17 00:00:00 2001 From: evilB Date: Tue, 4 Feb 2014 19:19:38 +0100 Subject: [PATCH] Reordered StateItem to prevent unwanted event Set the subscription to this.mappedValueComputed after setting of this.previousMappedValue see issue #12 --- src/knockout-projections.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/knockout-projections.js b/src/knockout-projections.js index 98c8957..e27abf9 100755 --- a/src/knockout-projections.js +++ b/src/knockout-projections.js @@ -27,8 +27,8 @@ See the Apache Version 2.0 License for specific language governing permissions a // Set up observables this.outputArrayIndex = ko.observable(initialOutputArrayIndex); // When excluded, it's the position the item would go if it became included this.mappedValueComputed = ko.computed(this.mappingEvaluator, this); + this.previousMappedValue = this.mappedValueComputed.peek(); // Must be set before subscription to mappedValueComputed, if not the subscription may be triggered this.mappedValueComputed.subscribe(this.onMappingResultChanged, this); - this.previousMappedValue = this.mappedValueComputed.peek(); } StateItem.prototype.dispose = function() {