We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given the following code snippet:
var data = { name: 'Scott', children: [ { id : 1, name : 'Alice' }, { id : 2, name : 'Bob' }, { id : 3, name : 'Chris' }, { id : 4, name : 'Robert' } ] } var mapping = { 'children': { key: function(data) { console.log(data.id); return ko.utils.unwrapObservable(data.id); } } } var viewModel = ko.mapping.fromJS(data, mapping);
Which is taken from the documentation, with slight modifications.
Expected result in console would be: 1 2 3 4
1 2 3 4
Actual result is: 1 2 3 4 1 2 3 4.
1 2 3 4 1 2 3 4
jsFiddle: http://jsfiddle.net/losnir/a2qMQ/
As mentioned in the title, the key callback is being fired twice.
key
The culprit seems to be on line 570 (filterArrayByKey, 1st fire) and on line 582 (keyCallback(unwrappedRootObject[i]), 2nd fire).
filterArrayByKey
keyCallback(unwrappedRootObject[i])
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Given the following code snippet:
Which is taken from the documentation, with slight modifications.
Expected result in console would be:
1 2 3 4
Actual result is:
1 2 3 4 1 2 3 4
.jsFiddle: http://jsfiddle.net/losnir/a2qMQ/
As mentioned in the title, the
key
callback is being fired twice.The culprit seems to be on line 570 (
filterArrayByKey
, 1st fire) and on line 582 (keyCallback(unwrappedRootObject[i])
, 2nd fire).The text was updated successfully, but these errors were encountered: