ButterCMS / buttercms-ruby

Ruby API client for ButterCMS (https://buttercms.com)
Other
25 stars 21 forks source link

ButterCMS::Post.all method does not return all posts if the page_size param is 20 and preview is set #21

Closed beewuu closed 3 years ago

beewuu commented 3 years ago

We currently have a combined total of 178 published and draft posts on butter.

Given this code

array = []
array += ButterCMS::Post.all(page_size: 100, page: 1, preview: 1).to_a
array += ButterCMS::Post.all(page_size: 100, page: 2, preview: 1).to_a
array.length => 178

That set of params correctly returns the number of posts into the array variable. I correctly get 178 back. If I change the page_size param from 100 to 20, I'm missing two posts.

array = []
array += ButterCMS::Post.all(page_size: 20, page: 1, preview: 1).to_a
array += ButterCMS::Post.all(page_size: 20, page: 2, preview: 1).to_a
array += ButterCMS::Post.all(page_size: 20, page: 3, preview: 1).to_a
array += ButterCMS::Post.all(page_size: 20, page: 4, preview: 1).to_a
array += ButterCMS::Post.all(page_size: 20, page: 5, preview: 1).to_a
array += ButterCMS::Post.all(page_size: 20, page: 6, preview: 1).to_a
array += ButterCMS::Post.all(page_size: 20, page: 7, preview: 1).to_a
array += ButterCMS::Post.all(page_size: 20, page: 8, preview: 1).to_a
array += ButterCMS::Post.all(page_size: 20, page: 9, preview: 1).to_a
array.length => 176

I ran the code above with page_size ranging from 1 - 100 and it seems only the number 20 incorrectly returns the number of blog posts.

The bug does appear to occur only when I pass in the preview param in combination with page_size = 20.

jakelumetta commented 3 years ago

Hey @beewuu - thanks for the note. Can you chat with our support on buttercms.com (chat bubble in the bottom right?) and reference this issue? That's the best channel for tech support. Cheers