[wp-trac] [WordPress Trac] #38484: REST API JS Client: currentPage should be set to the "paged" filter variable

WordPress Trac noreply at wordpress.org
Fri Oct 28 16:12:46 UTC 2016


#38484: REST API JS Client: currentPage should be set to the "paged" filter
variable
-----------------------------+------------------------------
 Reporter:  adamsilverstein  |       Owner:  adamsilverstein
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  REST API         |     Version:  trunk
 Severity:  normal           |  Resolution:  invalid
 Keywords:  needs-patch      |     Focuses:  javascript
-----------------------------+------------------------------
Changes (by adamsilverstein):

 * status:  assigned => closed
 * resolution:   => invalid
 * milestone:  4.7 =>


Comment:

 @peterigz Thanks for the bug report.

 I tested this and verified the client currently performs as expected if
 you use the 'page 'option', capturing the passed `page` parameter if you
 use it, and storing that in the collection state.currentPage. In your
 report you mentioned that you ''use the "paged" filter variable'' which
 may be the source of the problem, that method is not supported.

 Here is the correct way to use the `page` option with the api collection
 objects, I'll make update the docs reflect this usage:

 {{{
 // Load the posts collection.
 var posts = new wp.api.collections.Posts();

 // Load page 5.
 posts.fetch( { data: { page: 5 }  } )
         .done( function() {

                 // This loads page 6.
                 posts.more();
         } );
 }}}

 I loaded up 100+ dummy posts and verified this works correctly at the
 console:

 [[Image(https://cl.ly/2w1W3s1T3g2c/wpdev__Just_another_WordPress_site_2016-10-28_12-06-11.jpg)]]

 Thanks again for testing, closing as invalid.

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


More information about the wp-trac mailing list