[wp-trac] [WordPress Trac] #29775: Media manager bug

WordPress Trac noreply at wordpress.org
Fri Oct 3 18:28:58 UTC 2014


#29775: Media manager bug
-------------------------------+------------------------------
 Reporter:  rudybrinkman       |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Media              |     Version:  4.0
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by lucasstark):

 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.

 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.

 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.

 When sync is called from wp.media.model.Query after this problem occurs it
 only has 9 items in it's collection.

 Math.floor( 9 / 5 ) + 1 is 2, so it requests the same page of results
 again.

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


More information about the wp-trac mailing list