Skip to content
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

Loading the site editor hangs #60137

Closed
ajlende opened this issue Mar 22, 2024 · 6 comments
Closed

Loading the site editor hangs #60137

ajlende opened this issue Mar 22, 2024 · 6 comments
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended

Comments

@ajlende
Copy link
Contributor

ajlende commented Mar 22, 2024

Description

Loading the site editor hangs while loading. No errors showed up in the JS console or in the PHP error logs, but I found some that were being hidden in the core Redux state.

Reverting 959b616 fixes the issue.

{
  type: 'FAIL_RESOLUTION',
  selectorName: 'getSite',
  args: [],
  error: {
    code: 'invalid_json',
    message: 'The response is not a valid JSON response.'
  }
}
{
  type: 'FAIL_RESOLUTION',
  selectorName: 'getEntityRecord',
  args: [
    'root',
    'site',
    undefined
  ],
  error: {
    code: 'invalid_json',
    message: 'The response is not a valid JSON response.'
  }
}

It seemed this OPTIONS request added in https://github.com/WordPress/gutenberg/pull/59243/files#diff-38a74d088ea018dbbea00d8f5bd5c03ea54bfc099d1d1836686c24a5582bf579R420-R423 isn't returning JSON for me, triggering the errors.

OPTIONS /wp-json/wp/v2/settings?_locale=user HTTP/2
Host: wp.local
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:123.0) Gecko/20100101 Firefox/123.0
Accept: application/json, */*;q=0.1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: https://wp.local/wp-admin/site-editor.php
X-WP-Nonce: 15846d7f7d
Origin: https://wp.local
DNT: 1
Connection: keep-alive
Cookie: XDEBUG_SESSION=XDEBUG_ECLIPSE; wp-settings-1=libraryContent%3Dbrowse%26mfold%3Do%26posts_list_mode%3Dlist; wp-settings-time-1=1703206470; wordpress_logged_in_xxx; wp_lang=en_US; wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_xxx
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Pragma: no-cache
Cache-Control: no-cache
TE: trailers
HTTP/2 200 
server: nginx/1.16.0
date: Fri, 22 Mar 2024 20:23:56 GMT
content-type: text/plain; charset=utf-8
content-length: 0
access-control-allow-origin: *
access-control-allow-methods: *
access-control-allow-headers: *
access-control-max-age: 1728000
X-Firefox-Spdy: h2

Step-by-step reproduction instructions

  1. Open the site editor
  2. See that it hangs (screenshot below)

@Mamaduka and @jeryj both tried to reproduce the issue, but were unable to, so it must not affect all site configurations.

Screenshots, screen recording, code snippet

Screen Shot 2024-03-21 at 13 56 41

Environment info

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

@ajlende ajlende added the [Type] Bug An existing feature does not function as intended label Mar 22, 2024
@jordesign jordesign added Needs Testing Needs further testing to be confirmed. [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Mar 24, 2024
@Mamaduka
Copy link
Member

@ajlende, are you still able to reproduce the issue consistently?

@ajlende
Copy link
Contributor Author

ajlende commented Apr 11, 2024

@ajlende, are you still able to reproduce the issue consistently?

Yeah, I've still been working around it by reverting the commit in my local development. It's looking like something is causing the body of the OPTIONS request to be empty for me, so I don't think that #59243 is the root cause of the issue.

However, getting the errors from the Redux state is probably still a worthwhile task to come out of this even if it just means sending them to the error console with a stack trace to help with debugging and reporting problems if this ends up happening to anyone else.

@Mamaduka
Copy link
Member

@ajlende, what env are you using for local development?

I'm intentionally trying to reproduce the same editor's state, but without any success so far. I've tried throwing errors in entity resolves, but the editor still loads even though it's in a broken state.

IIRC, silencing the errors in the Redux state was an intentional decision. The actions have options to throw them, but selectors rely on FAIL_RESOLUTION metadata.

@tyxla, you worked on improving the Site Editor's loading state. Do you have any clues as to why this might be happening?

@ajlende
Copy link
Contributor Author

ajlende commented Apr 16, 2024

I've tried throwing errors in entity resolves, but the editor still loads even though it's in a broken state.

The response has to return 200 (success) with an incorrect empty body for the bug to trigger.

IIRC, silencing the errors in the Redux state was an intentional decision. The actions have options to throw them, but selectors rely on FAIL_RESOLUTION metadata.

We don't need the errors thrown, just logged in the JS console so you don't need to install the Redux extension to see if you have errors.

@tyxla
Copy link
Member

tyxla commented Apr 22, 2024

@ajlende I was unable to reproduce this earlier today.

Could you access and share with us the malformed request response with the errors, in case that sheds more light on what the underlying issue might be?

@ajlende
Copy link
Contributor Author

ajlende commented Apr 22, 2024

Thanks for taking a look @tyxla! I just tested trunk again today, and the site editor no longer hangs. 🤷 So closing this unless it pops up again.

@ajlende ajlende closed this as completed Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants