-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Widgets screen: sidebars endpoint returning inconsistent results for client/server #25982
Comments
I'm mostly concerned this might be a bug that we haven't noticed yet. Potentially though it might be a race condition, perhaps the preloading causes the data to be fetched much earlier before the plugin has had a chance to do some of its work. |
This still seems to be an issue when the Custom Sidebars plugin is disabled as well, so probably unrelated to that plugin. |
@talldan I'm having a little trouble tracing where the preloading mechanism queries the DB. I think it may be easier to try and setup a unit test case for preloading to see if there's a race condition. Edit: ah it's here https://developer.wordpress.org/reference/functions/rest_preload_api_request/ |
I tested this locally and can confirm that The issue is that the plugin has not had a chance to put the sidebar into the We may be able to perform |
Adding Needs Testing to this as I wonder if us calling |
I've tried to test this using the Gutenberg 12.4 RC1 plugin and WordPress 5.9 RC2. |
Describe the bug
When testing #25932, I noticed something curious about the sidebars endpoint.
I followed the steps for reproduction on #25932 and saw this:
Inspecting the data from the HTTP request, I noticed that none of the sidebars I'd created had a
name
property (unexpected), and they were all 'inactive' (probably expected since they were not assigned to an area).Through coincidence I disabled preloading for this request by commenting out this line - https://github.com/WordPress/gutenberg/blob/master/lib/widgets-page.php#L88
This forces the browser to make the request, and when doing so the
name
property was then present for all of the sidebars and all of them also havestatus: "active"
. On the screen I see this:The text was updated successfully, but these errors were encountered: