Make WordPress Core

Changeset 40040


Ignore:
Timestamp:
02/03/2017 09:45:06 PM (8 years ago)
Author:
adamsilverstein
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/wp-api.js

    r39680 r40040  
    186186
    187187                        // We already have args, merge these new args in.
    188                         modelInstance.prototype.args = _.union( routeEndpoint.args, modelInstance.prototype.defaults );
     188                        modelInstance.prototype.args = _.extend( modelInstance.prototype.args, routeEndpoint.args );
    189189                    }
    190190                }
     
    203203
    204204                            // We already have options, merge these new args in.
    205                             modelInstance.prototype.options = _.union( routeEndpoint.args, modelInstance.prototype.options );
     205                            modelInstance.prototype.options = _.extend( modelInstance.prototype.options, routeEndpoint.args );
    206206                        }
    207207                    }
Note: See TracChangeset for help on using the changeset viewer.