Skip to content

Navigation block: JS error when the block is placed inside a template part #52680

@carolinan

Description

@carolinan

Description

I am only able to reproduce this with Wp 6.3. current nightly and Gutenberg current trunk.
I have not tested in other themes than Twenty Twenty-Three.

In the Site editor,
When adding a navigation block inside a template part, and hovering over the Navigation menu in the block settings sidebar: (The three dots next to the text "Menu" in the first tab of the block settings),
I see this JS error in the console:

react-dom.min.js?ver=18:1 Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Brendered%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at ct (react-dom.min.js?ver=18:1:41145)
at p (react-dom.min.js?ver=18:1:42914)
at g (react-dom.min.js?ver=18:1:44061)
at e (react-dom.min.js?ver=18:1:46125)
at dr (react-dom.min.js?ver=18:1:54774)
at $s (react-dom.min.js?ver=18:1:122387)
at Sl (react-dom.min.js?ver=18:1:88649)
at kl (react-dom.min.js?ver=18:1:88577)
at bl (react-dom.min.js?ver=18:1:88440)
at sl (react-dom.min.js?ver=18:1:85264)

Objects are not valid as a React child (found: object with keys {rendered}). If you meant to render a collection of children, use an array instead.

Step-by-step reproduction instructions

In the site editor, select an existing template part or create a new.
Add a navigation block as a direct child. It has to be a direct child: if you place the navigation block inside a group block first, the JS error does not appear. If you wrap the navigation block after placement, the JS error dissapears.

With the navigation block selected, hover over the first ellipsis menu in the first tab of the block settings sidebar, and see the JS error.

Screenshots, screen recording, code snippet

js-error.mp4

Environment info

Active plugin: Beta tester. Gutenberg current trunk

WP 6.3-beta4-56243
nginx
PHP 8.1.9., 8.0.2 (tested on two different installations, with and without demo content)
Mac OS 13.4.1
Chrome 114.0.5735.198

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] NavigationAffects the Navigation Block[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions