Closed adamwinzdesign closed 3 years ago
So after a little bit of experimentation, I determined that we have to initialize the page variable to 1, not to 0. This is because the unsplash api returns the first ten photo results during the initial load with page as 0 by default, even though there technically is no page 0 because the first ten results are returned whether page is set to 0 or 1. So, if we start with page as 0, we get the first ten results, and when the user scrolls for the first time, page increases by 1, and the first ten results are returned again, then the next ten results, and so on.
Recreate issue by loading the first set of 10 photos, then scrolling down in order to fetch more photos. The first set of 10 photos are displayed twice, then the additional photos are added to the list.
Initial load:
After scroll:
As you can see, the car, bookshelf, camera, and portrait repeat on scroll.