From 4b22b970041735b9bd478f6106dbf1eec4d11d1d Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Fri, 3 Feb 2017 21:45:06 +0000 Subject: [PATCH] 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 --- src/wp-includes/js/wp-api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/wp-api.js b/src/wp-includes/js/wp-api.js index ccda6a0e8b..da16e3c491 100644 --- a/src/wp-includes/js/wp-api.js +++ b/src/wp-includes/js/wp-api.js @@ -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 ); } }