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.
Fixes #39341.



git-svn-id: https://develop.svn.wordpress.org/trunk@40040 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Adam Silverstein 2017-02-03 21:45:06 +00:00
parent 0b63252b2d
commit 4b22b97004

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 );
}
}