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. |