-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getEntityRecords
for wp_template
returns null
the first time it runs.
#36380
Comments
Hi there! this is basically the behavior of any async selector. The first time the selector returns null and triggers a resolver. What might have changed is that the selector might not be preloaded anymore. And If I'm not wrong "templates" don't support pagination, so you should drop the |
Thanks for chiming in, Riad! Do we know why that's the case now? It seems counter-intuitive to return |
I have notice that before, this is way sometimes I don't use it. And prefer to use |
That makes sense. 👍 |
The relevant preloading happens here: gutenberg/lib/full-site-editing/edit-site-page.php Lines 109 to 128 in 1dc8d6d
The
So it's a bit surprising that |
To elaborate a bit more, preloading means that on the PHP side, we list REST API endpoints whose responses we want to make available upon first loading a given page (such as the site editor). WordPress will then embed those responses into the server-generated HTML, and make them available to the JS on the client side. To inspect, navigate to the site editor, switch to "View Source", and Cmd+F |
FWIW, if I do that, I do see preloaded data for Based on Addie's description, this might be a good candidate for bisecting:
cc/ @fullofcaffeine since you're experienced with using bisect to track down issues like this 😬 |
Dug a bit and found a PR that could be related: #36044 |
Yes, I think what I did on that PR is to remove the |
FWIW, I did try |
I'll have a look today 👀 |
@ockham Bisect points me to #35802. You can verify by:
|
Thanks for the ping, @fullofcaffeine. It's weird that #35802 affected pre-loading at all. PR only adds an extra argument to the REST API endpoint. I'm looking at the issue right now and will post my findings shortly. |
I did more testings, and I don't think this is a regression. You'll get similar results if you try to fetch pages in Site Editor and this path is also preloaded - What has changedGutenberg 11.9 removed Why pre-loaded paths return
|
Hi, @Addison-Stavlo I just wanted to check in to see if we can close this issue? |
Certainly! If the consensus is that this is not a regression, feel free to close it. I noticed it had changed, but didn't realize it was expected behavior since the nav panel was removed. Thanks for the explanation! |
I'm still confused as to why #35802 ends up causing the call to return @Mamaduka What you mention in your comment here makes sense. I wonder if the it's somehow related to what @ockham mentioned here, though (TL;DR: for some reason #35802 caused that endpoint not to be preloaded anymore?). Don't feel rushed to reply to this, I just wanted to try to clarify a bit further but I understand that it's not as critical as we originally thought (or might not be an issue at all, atm). |
@fullofcaffeine, the "Navigation Panel" was restored in 11.9.1 (#36516) and now running the following selector returns values from the state:
I've not done a git bisect for this issue myself, but I don't think #35802 changed anything based on this. |
@Mamaduka Thanks! |
Description
This seems to be a recent regression that I can not reproduce on 11.8, but is present in 11.9 RCs and current
trunk
branch.Core
getEntityRecords
selector forwp_templates
returnsnull
the first time it runs after loading the editorStep-by-step reproduction instructions
wp.data.select( 'core' ).getEntityRecords( 'postType', 'wp_template', { per_page: -1, } )
null
as the result.Screenshots, screen recording, code snippet
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
The text was updated successfully, but these errors were encountered: