Open afercia opened 2 months ago
Hi Mate, I am looking into this and let you know if I can fix it :)
Hi,
I've reviewed it, and here are my thoughts:
When clicking on pagination numbers, there's a setting in a separate block called "Number Of Links." This setting determines how many numbers will appear before and after the current pagination number. But this is not a solution.
To dynamically change the pagination number, we must fetch the count of posts from the selected post type when initializing the query loop block. Depending on the parameters selected—like Items per page, Offset, and Max pages to show—we'll dynamically generate the appropriate number of pagination links and replace them with the current ones.
Regarding 2, do you think implementing this will result in additional fetch requests to get the post count?
Regards, A. V.
do you think implementing this will result in additional fetch requests to get the post count?
It's a reasonable concern but this already happens when changing the 'Items per page' and 'Offset' values. At each change, posts are fetched including all the posts content, which may be potentially huge. As far as I see, the responses are cached so that subsequent requests with the same values won't trigger a new fetch.
On the other hand, triggering a new request at any React onChange
event doesn't seem to be ideal. Especially when changing the values by using the number input arrows button or by using the keyboard. Say I want to change 'Items per page' form 10 to 20. That would trigger 10 requests each time the value changes.
It's an UI / interaction issue. This kind of UIs that trigger requests should be implemented by 'debouncing' the request. WordPress Core does that in a few places:
Debouncing should be a standard in these cases. Cc @youknowriad any thoughts? I guess it's worth creating a new issue.
Description
Discovered while working on https://github.com/WordPress/gutenberg/pull/63020
The editor is supposed to provide a preview of the blocks (the entire page, I would say) that is as close as possible to the page on the front end. However, it appears the Query loop 'Max page to show' setting doesn't provide any preview in the editor. It just stays in its default view.
Not sure but this may happen because the Paginaion is actually a separate block. Regardless, as a user I'd be pretty disoriented by not seeing any change in the editor preview and think there's something not working as expected.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes