[wp-trac] [WordPress Trac] #36697: Combining the HTTP requests for obtaining the available nav menu items into a single request

WordPress Trac noreply at wordpress.org
Sun Oct 30 06:24:16 UTC 2016


#36697: Combining the HTTP requests for obtaining the available nav menu items into
a single request
-------------------------------------------------+-------------------------
 Reporter:  nguyencongtuan                       |       Owner:  curdin
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  4.7
Component:  Customize                            |     Version:  4.3
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing needs-patch needs-     |     Focuses:
  unit-tests                                     |
-------------------------------------------------+-------------------------
Changes (by westonruter):

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


Comment:

 @curdin thanks for that.

 I've opened a pull request for review and additional revisions. Here are
 the first few changes I've made: https://github.com/xwp/wordpress-
 develop/pull/189/files/b0c89dc..30f3739

 A couple other outstanding issues that need to be fixed:

 * Pagination is broken when infinite scrolling through available nav menus
 of a given type. Fetching of new items for a given type needs to be
 updated to use the new request signature. So `loadItems` needs to work
 both with single type and multiple types.
 * PHP unit tests are broken.

 Instead of modifying the existing Ajax request to require multiple item
 types, I think that perhaps `loadItems` should be smarter about whether
 its first argument is an array of `itemType` objects or a single
 `itemType` object. In the latter case, it can make the request with the
 `object` and `type` params as previously, and this would ensure backwards
 compatibility and should prevent the tests from breaking. But an array of
 `itemType` objects are passed, then this is when the Ajax request can be
 made with the an `item_types` array instead, and this is what would key in
 the new functionality to do the bulk request.

 Is this something you can pick up? I'll attach my latest patch as well in
 case you don't want to collaborate on GitHub instead.

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


More information about the wp-trac mailing list