I'm using the most recent version - 4.4.0.
Minimal reproduce steps:
- Site must have 1000's of posts on it
- Create a new post
- Add AQL block
- Change Query Type from Default to Custom
- Attempt to hit Publish. It looks like it's working, but never actually completes.
The source of the issue is this block of code in src/components/post-exclude-controls.js:
// Get the posts for all post types used in the query.
const posts = useSelect(
( select ) => {
const { getEntityRecords } = select( 'core' );
// Fetch posts for each post type and combine them into one array
return [ ...multiplePosts, postType ].reduce(
( accumulator, type ) => {
// Depending on the number of posts this could take a while, since we can't paginate here
const records = getEntityRecords( 'postType', type, {
per_page: -1,
} );
return [ ...accumulator, ...( records || [] ) ];
},
[]
);
},
[ postType, multiplePosts ]
);
With per_page set to -1, core middleware changes that to a paged run of queries with per_page: 100, as page=1, page=2, ...etc. On the site I'm working on, each query takes many seconds to complete, and the save action in the editor will not complete until all pages have been retrieved. This affects autosaves as well as user initiated saves.
Interestingly, if you do the same reproduce steps on a page as opposed to a post, the save action completes, even though that paging run remains ongoing.
Besides causing an issue saving the post, this is also a burden on the server having to unnecessarily deal with a string of requests that take many seconds to complete.
My expectation would be that it only fetches posts if there's a search string to narrow down the list of results.
I'm using the most recent version - 4.4.0.
Minimal reproduce steps:
The source of the issue is this block of code in src/components/post-exclude-controls.js:
With
per_pageset to -1, core middleware changes that to a paged run of queries withper_page: 100, aspage=1,page=2, ...etc. On the site I'm working on, each query takes many seconds to complete, and the save action in the editor will not complete until all pages have been retrieved. This affects autosaves as well as user initiated saves.Interestingly, if you do the same reproduce steps on a
pageas opposed to apost, the save action completes, even though that paging run remains ongoing.Besides causing an issue saving the post, this is also a burden on the server having to unnecessarily deal with a string of requests that take many seconds to complete.
My expectation would be that it only fetches posts if there's a search string to narrow down the list of results.