Page List: Parent control query limit is too small
Description
The block "page list" can not be used for websites with more than 100 pages.
When editing the page with the "page list" a list of pages is loaded. This list is limited to 100 elements. Pages at the end of the hierarchy of the website are not available.
Solution 1:
Set the limit to a higher value, 500 may be good.
if (isset($params['per_page'])) {
$params['per_page']['maximum'] = 500;
}
Solution 2:
We have to chose a parent-page but also pages without childs are loaded. A smarter filter for "pages with childs" will reduce the length of the list.
Step-by-step reproduction instructions
- Website with more then 100 pages
- Edit a page
- insert page list
- configure page list
- try to chose a page at the end of the content
Screenshots, screen recording, code snippet
Environment info
WordPress 6.7.2 Theme Blocksy Gutenberg is not installed Language German
Please confirm that you have searched existing issues in the repo.
- [x] Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- [x] Yes
Please confirm which theme type you used for testing.
- [ ] Block
- [ ] Classic
- [ ] Hybrid (e.g. classic with theme.json)
- [x] Not sure
Note that we can't simply fix this problem by changing the maximum value to 500. See https://github.com/WordPress/gutenberg/pull/69676#discussion_r2010018711
If I recall correctly, at some point the authors dropdown did multiple simultaneous requests to get all the authors. The use of simultaneous requests reduced memory issues within PHP.
@kadamwhite I think you worked on this, do you recall the details?
@peterwilsoncc, we can do unbound queries (-1), but the block has a note on why it uses a hardcoded max pages value.
https://github.com/WordPress/gutenberg/blob/8cfa39e7349037b0c1b475da3994f6c839cb9163/packages/block-library/src/page-list/edit.js#L43-L45