Skip to content

Commit

Permalink
perf(reactive): skip comparing on initial data
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela committed Mar 19, 2016
1 parent 252d2d4 commit 21a1805
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/modules/reactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,12 @@ angular.module(name, [
activeObservation = handle.observation;
modelData = handle.data;

const diff = jsondiffpatch.diff(lastModelData, modelData);
vm[k] = jsondiffpatch.patch(lastModelData, diff);
if (lastModelData.length !== 0) {
const diff = jsondiffpatch.diff(lastModelData, modelData);
vm[k] = jsondiffpatch.patch(lastModelData, diff);
} else {
vm[k] = modelData;
}

lastModel = model;
lastModelData = modelData;
Expand Down

0 comments on commit 21a1805

Please sign in to comment.