WordPress/gutenberg

Non-error, unexpected response for `_wp-find-template` not handled

strarsis opened this issue · 1 comments

Description

When a non-error, unexpected response (not HTTP 404, but 200) is sent for a _wp-find-template request, e.g. a HTML page,
no error or warning message is emitted, instead the Gutenberg site editor simply stays blank, without any indication for why it fails.

Related issue: #37236
The added error handling doesn't validate the response schema/data. A HTTP 400 response with HTML will not cause an error, instead the editor simply stays blank.

That a HTML response is sent back for _wp-find-template can be caused by loaders in themes that add support for additional languages, e.g. Blade-PHP for hybrid FSE themes.

Step-by-step reproduction instructions

  1. Create a theme that supports Full Site Editing (FSE).
  2. Simulate a bug where a non-error, unexpected error response is send for _wp-find-template requests from the Gutenberg site editor.
  3. Open the Gutenberg site editor, note that it does a _wp-find-template request, receives the unexpected, non-error response and stays blank.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress version 6.0.3, Gutenberg version 14.3.1 .

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 same issue also occurs when remove_theme_support('block-templates'); is used but a theme.json and block-templates/-parts are included, with which the (FSE) site editor is offered. The Design → Editor feature is still available, but the editor then fails to initialize.