Closed CarlosLongarela closed 7 months ago
How strange— it looks like changing the "items per page" value is also changing the offset
— I tried this on a WC site and saw API requests like this:
/wp-json/wp/v2/posts?context=edit&offset=40&order=desc&orderby=date&per_page=4&sticky=false&_locale=user
/wp-json/wp/v2/posts?context=edit&offset=50&order=desc&orderby=date&per_page=5&sticky=false&_locale=user
Increasing the offset just added to it:
/wp-json/wp/v2/posts?context=edit&offset=51&order=desc&orderby=date&per_page=5&sticky=false&_locale=user
Off the top of my head, I don't know what could be interfering there.
Yes, it's very strange. I made a test in another multisite (that it isn't a WordCamp multisite) and the Query Loop works without any problem (and works with the number as integer and as string).
I'd imagine it's some filtering pre_get_posts
for something else, since the offset always seems to be 40
plus the offset from the query loop block.
since the offset always seems to be 40 plus the offset from the query loop block.
In my testing, the offset was per_page * 10 + offset
— when I set it to 2 per page, it's offset=20, 3 -> offset=30, and so on.
The strange part to me is that the API request is what's changed, so the API response is correct (to what it's asked for) but somewhere in the "fetch posts" logic it's changing the query.
Oh, it's not math but concatenation — perPage + offset
. It looks like this was an issue in Gutenberg (https://github.com/WordPress/gutenberg/issues/56439), and should have been fixed in 17.2, but WordCamp.org is still on 17.1.2. Updating GB should fix the issue.
Oh, fantastic news, but WordCamp.org could be updated to 17.2? or we have any solution to this to finish our team design and go live?
Gutenberg has been updated to 17.5.1, which resolves the issue.
It looks like that upgrade broke the query-filter block on events.w.org, see #1225 for details
Unfortunately we've had to temporarily roll back Gutenberg to 17.1.4 to fix the above issue with the Events homepage query filters, so this issue will be present again. We plan to ship another fix asap. Sorry for any inconvenience caused.
The WordCamp network has been updated to Gutenberg 17.6, so this should be fixed again.
Query loop block it's not working if we change the number of results to show because saves as string and only works as string.
This happens in the WordCamp multisite. Checked in another multisite non-WordCamp and working fine.
To reproduce
Steps to reproduce the behaviour:
We have the problem with our staging website https://wceutest24.wordcamp.org/2024/ and also live website https://europe.wordcamp.org/2024/
A recorded a video with several tests and the bug: https://video.tabernawp.com/conversations/fa2cdc82-7f9a-570d-9769-b2e351641649