REST API: JavaScript client should use `_.extend` when merging objects.

Correct an issue during the client's dynamic route discovery in `wp.api.utils.decorateFromRoute` where `_.union` potentially failed if used on objects.

Props ketuchetan, adamsilverstein.
Merges [40040] to the 4.7 branch.
Fixes #39341.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40084 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2017-02-20 06:34:17 +00:00
parent 8531c4e5a6
commit f6c038da0c
1 changed files with 2 additions and 2 deletions

View File

@ -185,7 +185,7 @@
} else {
// We already have args, merge these new args in.
modelInstance.prototype.args = _.union( routeEndpoint.args, modelInstance.prototype.defaults );
modelInstance.prototype.args = _.extend( modelInstance.prototype.args, routeEndpoint.args );
}
}
} else {
@ -202,7 +202,7 @@
} else {
// We already have options, merge these new args in.
modelInstance.prototype.options = _.union( routeEndpoint.args, modelInstance.prototype.options );
modelInstance.prototype.options = _.extend( modelInstance.prototype.options, routeEndpoint.args );
}
}