[wp-trac] [WordPress Trac] #39341: problem in wp-api.js line 205

WordPress Trac noreply at wordpress.org
Tue Dec 20 14:57:04 UTC 2016


#39341: problem in wp-api.js line 205
-------------------------------------------------+-------------------------
 Reporter:  Magenta Cuda                         |       Owner:
     Type:  defect (bug)                         |  adamsilverstein
 Priority:  normal                               |      Status:  assigned
Component:  REST API                             |   Milestone:  Awaiting
 Severity:  normal                               |  Review
 Keywords:  has-patch dev-feedback needs-        |     Version:  4.7
  testing needs-unit-tests                       |  Resolution:
                                                 |     Focuses:  javascript
-------------------------------------------------+-------------------------
Changes (by adamsilverstein):

 * keywords:   => has-patch dev-feedback needs-testing needs-unit-tests


Comment:

 @Magenta Cuda

 I dug into the code a bit and for our default routes the model prototypes
 didn't have default options or args, so the `_.union` call was never
 reached. You are correct though that `args` or `options` at this point
 would be an object, not an array, so `_.extend` is more appropriate here.

 In [attachment:39341.diff] I fixed up the logic and switched from union to
 extend. If you have an issue that was caused by this bug I would
 appreciate if you could test the patch to see if it resolves your issue. I
 am going to try to add a unit test by mocking a custom endpoint that
 provides the default args & options this code is designed to extend, see
 #39264.

 Thanks.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39341#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list