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:
parent
8531c4e5a6
commit
f6c038da0c
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user