-
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
Improve Site Editor error state - prevent blank screen on REST API error #37236
Comments
You can also comment out this line to reproduce the issue:
|
It looks like a non trivial amount of people encounter this error (see #36687) so definitely something we need to improve. We should display the JSON error that comes back from Here's how I patched diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php
index 264c1181c0..6d0f278387 100644
--- a/src/wp-includes/block-template.php
+++ b/src/wp-includes/block-template.php
@@ -73,6 +73,9 @@ function locate_block_template( $template, $type, array $templates ) {
$block_template = resolve_block_template( $type, $templates, $template );
+ $template = null;
+ $block_template = null;
+
if ( $block_template ) {
if ( empty( $block_template->content ) && is_user_logged_in() ) {
$_wp_current_template_content = |
#38655 should add error handling. I still feel like we need a good understanding of what causes the errors (there have been a few reports). If it's only caused by a misconfiguration (like mentioned in https://core.trac.wordpress.org/ticket/54507), is there anything we can do in site health to assist in detecting the problem? |
I think one cause of the error is PHP template fallbacks. Steps to reproduce:
More details can be found in #35560 |
@mkaz Could you show you what you didn't have in your .htaccess file? It would help with my attempt to reproduce the problem I reported in #38699 |
Just a standard htaccess file redirecting all non-files to WP
|
I think we can close this as fixed by #38655. We're no longer showing a BSOD. We can fix bugs that result in an error being shown in separate GitHub issues e.g. #35560.
I followed these steps and confirmed that an error was shown and not a BSOD. |
What problem does this address?
If there is an API error loading templates for the site editor, the user is left with a completely blank screen. No visible error messages or ability to click towards next steps.
Original ticket: https://core.trac.wordpress.org/ticket/54507
From @noisysocks:
Testing
One way to trigger an API error, though there are others I'm sure, is to misconfigure your server rewrites. I did so using Apache and setting permalinks within WordPress but without having an
.htaccess
file with the needed rewrite rules.What is your proposed solution?
Display an error message or ability to navigate.
There might be several ways to solve - I did notice the
is-fullscreen-mode
class is added to the body which hides the sidebar, if that class is added after the page loads than if it fails to load, the user will still have the standard /wp-admin/ sidebar. The drawback is the UI flashes during the load.I think another option would be to remove this class on a failure if that can be detected. If the
is-fullscreen-mode
body class is removed the sidebar would show, at least giving the user a way to navigate elsewhere.The text was updated successfully, but these errors were encountered: