Skip to content

Commit

Permalink
only check trackable on children
Browse files Browse the repository at this point in the history
  • Loading branch information
jsearles committed Jun 12, 2015
1 parent 08a7974 commit 240cb84
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions dist/knockout-es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
}

function wrap(obj, props, deep) {
if (!props.length || !canTrack(obj)) {
if (!props.length) {
return;
}

Expand Down Expand Up @@ -127,7 +127,11 @@
notifyWhenPresentOrFutureArrayValuesMutate(ko, observable);

if (deep) {
origValue.forEach(function (child) { wrap(child, Object.keys(child), true); });
origValue.forEach(function (child) {
if (canTrack(child)) {
wrap(child, Object.keys(child), true);
}
});
}
} else if (deep && canTrack(origValue)) {
wrap(origValue, Object.keys(origValue), true);
Expand Down
2 changes: 1 addition & 1 deletion dist/knockout-es5.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/knockout-es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
}

function wrap(obj, props, deep) {
if (!props.length || !canTrack(obj)) {
if (!props.length) {
return;
}

Expand Down Expand Up @@ -127,7 +127,11 @@
notifyWhenPresentOrFutureArrayValuesMutate(ko, observable);

if (deep) {
origValue.forEach(function (child) { wrap(child, Object.keys(child), true); });
origValue.forEach(function (child) {
if (canTrack(child)) {
wrap(child, Object.keys(child), true);
}
});
}
} else if (deep && canTrack(origValue)) {
wrap(origValue, Object.keys(origValue), true);
Expand Down

0 comments on commit 240cb84

Please sign in to comment.