WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.36k stars 4.14k forks source link

Site title: This block has encountered an error + JS error #20337

Closed carolinan closed 4 years ago

carolinan commented 4 years ago

Describe the bug

This is theme independent.

In the standard block editor: When I add a site title block and either save or publish my post, the block is broken if I refresh the page.

The following message is shown: This block has encountered an error and cannot be previewed.

In the site editor: The following message is shown: This block has encountered an error and cannot be previewed.

I see the following JS error in both editors:

react-dom.min.b694e242.js?ver=16.9.0:103 TypeError: Cannot read property 'value' of undefined
    at qt (index.js?ver=e13e5f55eaf91ae01988a7640c93c41b:1)
    at edit (index.js?ver=a1729657b90fb940dcfe4a9db5362d4b:8)
    at je (react-dom.min.b694e242.js?ver=16.9.0:78)
    at ph (react-dom.min.b694e242.js?ver=16.9.0:215)
    at lh (react-dom.min.b694e242.js?ver=16.9.0:126)
    at O (react-dom.min.b694e242.js?ver=16.9.0:121)
    at ze (react-dom.min.b694e242.js?ver=16.9.0:118)
    at react-dom.min.b694e242.js?ver=16.9.0:53
    at unstable_runWithPriority (react.min.0212dc62.js?ver=16.9.0:26)
    at Ma (react-dom.min.b694e242.js?ver=16.9.0:52)

To reproduce Steps to reproduce the behavior:

  1. Create a new post or page, or edit an existing one
  2. Add a site title block
  3. Save or Publish
  4. Refresh the page

Or, open a block based theme, for example Twenty Nineteen Blocks which already has a site title block added, in the site editor.

Expected behavior I expected the block to not cause warnings or errors.

Desktop (please complete the following information):

Additional context Gutenberg Master Latest commit 5d8701c (built without errors)

WordPress 5.4-beta2-47310 PHP version 7.3.13

youknowriad commented 4 years ago

cc @epiqueras

epiqueras commented 4 years ago

What’s your user’s role/permissions level?

carolinan commented 4 years ago

Administrator (single install, not multisite) Maybe its a WordPress 5.4-beta2-47310 combo issue.

epiqueras commented 4 years ago

Can you try the plugin and get a full stack trace?

carolinan commented 4 years ago

I don't know if I copied this correctly... I turned off all browser extensions and updated to WordPress 5.4-beta2-47325, same result.

18:00:20.943 load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4-beta2-47325:8 JQMIGRATE: Migrate is installed, version 1.4.1 18:00:21.204 index.js?ver=16bb7f1936ebd6bf3b0ea3b3b2167159:1 wp.editor.withColors is deprecated. Please use wp.blockEditor.withColors instead. c @ index.js?ver=16bb7f1936ebd6bf3b0ea3b3b2167159:1 18:00:21.727 react-dom.min.b694e242.js?ver=16.9.0:103 TypeError: Cannot read property 'value' of undefined at qt (index.js?ver=e13e5f55eaf91ae01988a7640c93c41b:1) at edit (index.js?ver=a1729657b90fb940dcfe4a9db5362d4b:8) at je (react-dom.min.b694e242.js?ver=16.9.0:78) at ph (react-dom.min.b694e242.js?ver=16.9.0:215) at lh (react-dom.min.b694e242.js?ver=16.9.0:126) at O (react-dom.min.b694e242.js?ver=16.9.0:121) at ze (react-dom.min.b694e242.js?ver=16.9.0:118) at react-dom.min.b694e242.js?ver=16.9.0:53 at unstable_runWithPriority (react.min.0212dc62.js?ver=16.9.0:26) at Ma (react-dom.min.b694e242.js?ver=16.9.0:52) ve @ react-dom.min.b694e242.js?ver=16.9.0:103 18:00:21.874 post.php?post=2052&action=edit:1 [DOM] Found 2 elements with non-unique id #_wpnonce: (More info: https://goo.gl/9p2vKq) <input type=​"hidden" id=​"_wpnonce" name=​"_wpnonce" value=​"e86e390dee">​ <input type=​"hidden" id=​"_wpnonce" name=​"_wpnonce" value=​"233ddee523">​ 18:00:22.036 Inter-upright-var.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found) 18:01:21.476 load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4-beta2-47325:4 XHR finished loading: POST "http://localhost:8888/wp-admin/admin-ajax.php". send @ load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4-beta2-47325:4 ajax @ load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4-beta2-47325:4 l @ load-scripts.php?c=0&load[chunk_0]=hoverIntent,common,hoverintent-js,admin-bar,heartbeat&ver=5.4-beta2-47325:11 (anonymous) @ load-scripts.php?c=0&load[chunk_0]=hoverIntent,common,hoverintent-js,admin-bar,heartbeat&ver=5.4-beta2-47325:11

Will try the the plugin (7.5.0) next.

carolinan commented 4 years ago

Except the missing css class on the front that is a known issue, the site title block works with 7.5.0.

epiqueras commented 4 years ago

Did Core change something with the API here @TimothyBJacobs?

TimothyBJacobs commented 4 years ago

Not to my knowledge. Looking at the useEntityProp code, could this happen if the resolver hasn't been resolved?

epiqueras commented 4 years ago

Yes, but the block should render after that unless there is an error happening.

TimothyBJacobs commented 4 years ago

Right, but wouldn't an error happen because useEntityProp is trying to destruct a null value?

epiqueras commented 4 years ago

Yes

carolinan commented 4 years ago

I am no longer able to reproduce this.