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

Navigation block: "This block has encountered an error and cannot be previewed." on a fresh beta 1 install #58987

Closed
annezazu opened this issue Feb 14, 2024 · 16 comments
Labels
[Block] Navigation Affects the Navigation Block [Type] Bug An existing feature does not function as intended

Comments

@annezazu
Copy link
Contributor

To replicate, use this instaWP link to use a site with beta 1: https://app.instawp.io/launch?t=beta-rc&d=v2 Go to Appearance > Editor and see the error. I'm not quite sure what's going on but opening for now after @courtneyr-dev replicated.

@annezazu annezazu added [Block] Navigation Affects the Navigation Block [Type] Bug An existing feature does not function as intended labels Feb 14, 2024
@annezazu annezazu moved this to ❓ Triage in WordPress 6.5 Editor Tasks Feb 14, 2024
@annezazu
Copy link
Contributor Author

cc @getdave with how much nav block work you've done :D

@carolinan
Copy link
Contributor

Also reported here: https://core.trac.wordpress.org/ticket/60531

@t-hamano
Copy link
Contributor

I was able to reproduce this problem, but it doesn't seem to happen all the time. I was able to reproduce it with InstaWP, but I could not reproduce it in a local environment using wp-env.

Below are the steps I was able to reproduce.

  • Launch a fresh site with InstaWP
  • Upgrade to Beta1 with Beta Tester plugin
  • Access Appearance > Editor
  • Once the canvas has finished loading, the navigation block should be broken.
03e1475eb6f4ec0930db5f16dbf34897.mp4

When SCRIPT_DEBUG was enabled, the following log was recorded in the browser console.

log
block-serialization-default-parser.js?ver=1d1bef54e84a98f3efb9:437 Uncaught TypeError: document.substr is not a function
    at addFreeform (block-serialization-default-parser.js?ver=1d1bef54e84a98f3efb9:437:33)
    at proceed (block-serialization-default-parser.js?ver=1d1bef54e84a98f3efb9:286:9)
    at parse (block-serialization-default-parser.js?ver=1d1bef54e84a98f3efb9:266:12)
    at parser_parse (blocks.js?ver=fcc5a15c8926fa660a9d:13986:79)
    at core-data.js?ver=0617dde79e200098b252:7317:61
    at mountMemo (react-dom.js?ver=18.2.0:17235:21)
    at Object.useMemo (react-dom.js?ver=18.2.0:17680:18)
    at useMemo (react.js?ver=18.2.0:1640:23)
    at useEntityBlockEditor (core-data.js?ver=0617dde79e200098b252:7299:65)
    at NavigationInnerBlocks (block-library.js?ver=da799f40868de88da8d2:32655:100)
The above error occurred in the <NavigationInnerBlocks> component:

    at NavigationInnerBlocks (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-library.js?ver=da799f40868de88da8d2:32631:3)
    at div
    at div
    at div
    at div
    at ResponsiveWrapper (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-library.js?ver=da799f40868de88da8d2:32549:3)
    at nav
    at RecursionProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:62002:3)
    at EntityProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/core-data.js?ver=0617dde79e200098b252:7181:3)
    at Navigation (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-library.js?ver=da799f40868de88da8d2:34477:3)
    at <anonymous> (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:34665:9)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:34633:55
    at Edit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36036:5)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:18005:21
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/editor.js?ver=13672fc03fc7e8c04c78:5536:89
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10015:11
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10211:5
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10290:5
    at FilteredComponentRenderer (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:70220:9)
    at EditWithGeneratedProps (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36054:5)
    at BlockEdit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36108:3)
    at BlockCrashBoundary (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36448:5)
    at BlockListBlock (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:37399:10)
    at BlockWithLayoutStyles (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:32814:10)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:32874:59
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:18076:99
    at FilteredComponentRenderer (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:70220:9)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/data.js?ver=9fff958f5355452e2526:4466:25
    at BlockListBlockProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:37706:5)
    at Items (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46773:3)
    at BlockListItems
    at UncontrolledInnerBlocks (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46218:5)
    at div
    at GroupEdit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-library.js?ver=da799f40868de88da8d2:22808:3)
    at Edit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36036:5)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:18005:21
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/editor.js?ver=13672fc03fc7e8c04c78:5536:89
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10015:11
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10211:5
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10290:5
    at FilteredComponentRenderer (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:70220:9)
    at EditWithGeneratedProps (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36054:5)
    at BlockEdit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36108:3)
    at BlockCrashBoundary (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36448:5)
    at BlockListBlock (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:37399:10)
    at BlockWithLayoutStyles (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:32814:10)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:32874:59
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:18076:99
    at FilteredComponentRenderer (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:70220:9)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/data.js?ver=9fff958f5355452e2526:4466:25
    at BlockListBlockProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:37706:5)
    at Items (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46773:3)
    at BlockListItems
    at UncontrolledInnerBlocks (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46218:5)
    at div
    at GroupEdit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-library.js?ver=da799f40868de88da8d2:22808:3)
    at Edit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36036:5)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:18005:21
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/editor.js?ver=13672fc03fc7e8c04c78:5536:89
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10015:11
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10211:5
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10290:5
    at FilteredComponentRenderer (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:70220:9)
    at EditWithGeneratedProps (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36054:5)
    at BlockEdit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36108:3)
    at BlockCrashBoundary (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36448:5)
    at BlockListBlock (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:37399:10)
    at BlockWithLayoutStyles (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:32814:10)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:32874:59
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:18076:99
    at FilteredComponentRenderer (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:70220:9)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/data.js?ver=9fff958f5355452e2526:4466:25
    at BlockListBlockProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:37706:5)
    at Items (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46773:3)
    at BlockListItems
    at UncontrolledInnerBlocks (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46218:5)
    at div
    at GroupEdit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-library.js?ver=da799f40868de88da8d2:22808:3)
    at Edit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36036:5)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:18005:21
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/editor.js?ver=13672fc03fc7e8c04c78:5536:89
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10015:11
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10211:5
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10290:5
    at FilteredComponentRenderer (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:70220:9)
    at EditWithGeneratedProps (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36054:5)
    at BlockEdit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36108:3)
    at BlockCrashBoundary (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36448:5)
    at BlockListBlock (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:37399:10)
    at BlockWithLayoutStyles (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:32814:10)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:32874:59
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:18076:99
    at FilteredComponentRenderer (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:70220:9)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/data.js?ver=9fff958f5355452e2526:4466:25
    at BlockListBlockProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:37706:5)
    at Items (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46773:3)
    at BlockListItems
    at UncontrolledInnerBlocks (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46218:5)
    at ControlledInnerBlocks (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46284:3)
    at header
    at TemplatePartInnerBlocks (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-library.js?ver=da799f40868de88da8d2:58124:11)
    at RecursionProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:62002:3)
    at TemplatePartEdit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-library.js?ver=da799f40868de88da8d2:58200:3)
    at Edit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36036:5)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:18005:21
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/editor.js?ver=13672fc03fc7e8c04c78:5536:89
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10015:11
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10211:5
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:10290:5
    at FilteredComponentRenderer (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:70220:9)
    at EditWithGeneratedProps (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36054:5)
    at BlockEdit (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36108:3)
    at BlockCrashBoundary (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:36448:5)
    at BlockListBlock (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:37399:10)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:32874:59
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:18076:99
    at FilteredComponentRenderer (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:70220:9)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/data.js?ver=9fff958f5355452e2526:4466:25
    at BlockListBlockProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:37706:5)
    at Items (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46773:3)
    at BlockListItems
    at div
    at block_list_Root (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:46677:3)
    at BlockList
    at RecursionProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:62002:3)
    at StyleProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:34550:5)
    at body
    at iframe
    at Iframe (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:40367:3)
    at IframeIfReady (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:40520:71)
    at div
    at BlockTools (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:51144:3)
    at ExperimentalBlockCanvas (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:51282:3)
    at EditorCanvas (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/editor.js?ver=13672fc03fc7e8c04c78:15576:3)
    at EditorCanvas (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:35534:3)
    at div
    at Resizable (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:65089:28)
    at UnforwardedResizableBox (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:66116:3)
    at ResizableEditor (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:12646:3)
    at div
    at SlotComponent (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:34348:5)
    at Slot
    at UnforwardedSlot (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:34902:5)
    at EditSiteEditorCanvasContainerSlotSlot
    at SiteEditorCanvas (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:35853:20)
    at div
    at NavigableRegion (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:9335:3)
    at div
    at div
    at div
    at InterfaceSkeleton (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:9401:3)
    at BlockRefsProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:26739:3)
    at Provider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:34917:3)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:38525:5
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:38085:5
    at WithRegistryProvider(Component)
    at BlockContextProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/block-editor.js?ver=dffe880e6eb6f5d3eaa4:35991:3)
    at EntityProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/core-data.js?ver=0617dde79e200098b252:7181:3)
    at EntityProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/core-data.js?ver=0617dde79e200098b252:7181:3)
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/editor.js?ver=13672fc03fc7e8c04c78:15040:3
    at https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/editor.js?ver=13672fc03fc7e8c04c78:14407:5
    at WithRegistryProvider(Component)
    at Editor (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:36108:3)
    at div
    at MotionComponent (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:16829:46)
    at div
    at MotionComponent (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:16829:46)
    at Resizable (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:65089:28)
    at UnforwardedResizableBox (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:66116:3)
    at ResizableFrame (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:23498:3)
    at ErrorBoundary (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:22276:5)
    at div
    at MotionComponent (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:16829:46)
    at div
    at div
    at div
    at Layout (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:44824:3)
    at RouterProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/router.js?ver=24ab4c66bbafbf045980:912:3)
    at GlobalStylesProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:12188:3)
    at SlotFillProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:34761:3)
    at provider_SlotFillProvider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:34858:3)
    at Provider (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/components.js?ver=f1163dafd12ea2e4aa9c:34917:3)
    at App (https://joyful-koala-3d6400.instawp.xyz/wp-includes/js/dist/edit-site.js?ver=5a26db67d472336a4f13:45071:55)

React will try to recreate this component tree from scratch using the error boundary you provided, BlockCrashBoundary.

@ramonjd
Copy link
Member

ramonjd commented Feb 14, 2024

I can reproduce in WordPress 6.5-beta1-57630-src running Twenty Twenty-Four theme and with Gutenberg trunk:

  1. Opening the site editor. Usually in view mode.
Screenshot 2024-02-14 at 1 44 32 pm

I can't yet replicate when deactivating Gutenburg 😄

Here's the error I'm seeing

index.js:447 Uncaught TypeError: document.substr is not a function
    at addFreeform (index.js:447:34)
    at proceed (index.js:250:5)
    at parse (index.js:228:12)
    at parse (index.js:311:21)
    at entity-provider.js:205:19
    at mountMemo (react-dom.js?ver=18:17235:21)
    at Object.useMemo (react-dom.js?ver=18:17680:18)
    at useMemo (react.js?ver=18:1640:23)
    at useEntityBlockEditor (entity-provider.js:179:24)
    at NavigationInnerBlocks (inner-blocks.js:53:60)

As far as I can tell parse( content ) is expecting unparsed block HTML content, e.g., "<!-- wp:page-list /-->"

When the error fires, it's receiving rendered HTML content from getEditedEntityRecord

{
    "rendered": "<ul class=\"wp-block-page-list\"><li class=\"wp-block-pages-list__item\"><a class=\"wp-block-pages-list__item__link\" href=\"http://localhost:8888/?page_id=2\">Sample Page</a></li></ul>",
    "protected": false
}

The naive solution might be to check for a string before parsing the block content here:

if ( ! _blocks && typeof content === 'string' ) {

But since it's only happening for the navigation block, maybe it needs closer 👀

I did notice that the initial content matches the content property from the navigation-fallback API response, which has no content.raw property.

Whereas the navigation response does have a content.raw values of "<!-- wp:page-list /-->".

2024-02-14.13.59.06.mp4

@annezazu annezazu moved this from ❓ Triage to 📥 Todo in WordPress 6.5 Editor Tasks Feb 14, 2024
@huzaifaalmesbah
Copy link
Contributor

huzaifaalmesbah commented Feb 14, 2024

Reproduction Report

I was able to reproduce this issue.

Environment

  • WordPress: 6.5-beta1
  • PHP: 8.1.18
  • Server: LiteSpeed
  • Database: mysqli (Server: 10.3.38-MariaDB-0ubuntu0.20.04.1 / Client: mysqlnd 8.1.18)
  • Browser: Chrome 121.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Four 1.0
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.1.0
Screenshot 2024-02-14 at 11 42 42 AM

@Mamaduka
Copy link
Member

Mamaduka commented Feb 14, 2024

My finding also matches what @ramonjd discovered. The error can be consistently reproduced when the Navigation block lacks a ref and uses the fallback - <!-- wp:navigation /-->.

Here's a (rough) chain of events:

  1. The navigation is missing a ref and uses the getNavigationFallbackId().
  2. To avoid extra network requests, the getNavigationFallbackId resolver will try to populate the entity record from the response.
  3. The embedded record is missing the content.raw value in WP 6.5-beta1. The special handling for this was introduced in https://core.trac.wordpress.org/changeset/56793.
  4. Because of the missing raw attribute, the getEditedEntityRecord returns content as an object. See getRawEntityRecord for details.
  5. The entity provider fails to parse non-string content.

Update: Found source of regression - https://core.trac.wordpress.org/ticket/43439.

@getdave
Copy link
Contributor

getdave commented Feb 15, 2024

Thanks for the sleuthing. My understanding:

  • Core change caused a regression
  • The Nav Fallback tests didn't catch because they don't match real word usage of embed param.

Changes required:

  • fix Core issue to ensure content.raw is provided as it was previously.
  • update Gutenberg useEntityBlockEditor to avoid errors in this edge case of no content.raw.
  • update tests to provide coverage against future regressions.

@Mamaduka
Copy link
Member

That's correct.

update Gutenberg useEntityBlockEditor to avoid errors in this edge case of no content.raw.

This will be handled by #59058, but it only prevents the error, doesn't fix the issue with missing content.

update tests to provide coverage against future regressions.

The test_embedded_navigation_post_contains_required_fields needs to be updated in core to match request made by getNavigationFallbackId.

@getdave
Copy link
Contributor

getdave commented Feb 29, 2024

@Mamaduka I think we can close this now right as it was patched by #59058 and then #59220?

@Mamaduka
Copy link
Member

Yes, we can close this now.

@github-project-automation github-project-automation bot moved this from 🏗️ In Progress to ✅ Done in WordPress 6.5 Editor Tasks Feb 29, 2024
@MR444
Copy link

MR444 commented Apr 5, 2024

Having this problem after update to WordPress 6.5 stable.

It only appears in the template editor, not in the block editor. With which version was the "function" "Edit your template to edit this block" intruduced? Using twenty-twenty-three and could edit the blocks without the template editor before.

@ramonjd
Copy link
Member

ramonjd commented Apr 8, 2024

Having this problem after update to WordPress 6.5 stable.

I'm testing WordPress 6.6-alpha-57778-src running Twenty Twenty-Four theme (gutenberg disabled) and can't reproduce. Would you happen to have a screenshot or more test steps so that folks can confirm?

Thank you!

@MR444
Copy link

MR444 commented Apr 8, 2024

I am using Theme Twenty-Twenty-Three without Gutenberg and the problem appears on all my 3 websites. With a downgrade to 6.4.3 with "WP Downgrade" plugin everything looks fine and after I updte to 6.5 I get a block error that looks like this. I can reproduce the error on all three websites.
block-error

@MR444
Copy link

MR444 commented Apr 10, 2024

Just received the update to wordpress 6.5.2 but still the same problem. The error message only appears on all text blocks, other media is still visible.

@ramonjd
Copy link
Member

ramonjd commented Apr 10, 2024

Just received the update to wordpress 6.5.2 but still the same problem. The error message only appears on all text blocks, other media is still visible.

This issue related to the navigation block only, but if you're experiencing problems with other blocks it'd be helpful to open a new Github issue and outline the steps to reproduce, e.g., does it happen on all posts, even new ones, or just existing ones.

Also be sure to note if you're running any other plugins.

Thanks a lot!

@MR444
Copy link

MR444 commented May 5, 2024

The problem appears on all text blocks. Also on a brand new website without any plugins after I click on "Edit template". Don't know what else to say about this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Type] Bug An existing feature does not function as intended
Projects
Status: Done
Development

No branches or pull requests

8 participants