While overwriting in Server Action

Not sure if I’m doing something wrong or if this is a bug. I’m trying to get all photos from a Google album. Google serves a max of 100 photos at a time and provide a nextPage token to iterate through. I’m trying to use While to loop through while a nextpagetoken is provided.

What’s happening is the page loops through but only shows the last api_copy. I’ve confirmed this by changing the number of records returned by the API in each request using the pageSize parameter. The number of images returned in the api_copy is different. Those are also the last images in the album.

pageSize 50

pageSize 100

In my mind the api should be output in each iteration of the while but it appears it only outputs when it’s done. Is that by design?

Community Page
Last updated: