WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #29775, comment 7


Ignore:
Timestamp:
10/04/2014 11:56:02 AM (7 years ago)
Author:
lucasstark
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29775, comment 7

    initial v1  
    1 This may be related to a problem I noticed.   I am working on some custom backbone collections and have been reviewing media-models.js for reference.  To test out pagination I changed  the defaultArgs posts_per_page to 5 in wp.media.model.Query. 
    2 
    3 After making this change, whenever I load the media library grid it continues to request the same page of items from the server, over and over again.   
    4 
    5 Inspecting the ajax response it is getting the correct amount of items, 5 in this case, but it does not add all of them to the collection.  For some reason it correctly get's the first 5 items and adds them to the collection, it correctly then requests the second page of results from the server and it correctly receives 5 valid items, however it only adds 4 of them to the internal collection.
    6 
    7 When sync is called from wp.media.model.Query after this problem occurs it only has 9 items in it's collection.   
    8 
    9 Math.floor( 9 / 5 ) + 1 is 2, so it requests the same page of results again.