Skip to content

"The editor has encountered an unexpected error." for CPT with hierarchical option enabled, with the page-attributes without title support #19002

Closed

Description

@mipon

Describe the bug
The Gutenberg editor crushes with the error "The editor has encountered an unexpected error." when creating a new post for a custom post type that supports hierarchical relations and page attributes without the title support with the supports argument.

    'hierarchical' => true,
    'supports' => array( 'page-attributes', 'editor' ), // omit 'title'

Error

TypeError: Cannot read property 'raw' of undefined
at http://{site address}/wp-includes/js/dist/editor.min.js?ver=9.7.5:11:66922
at Array.map (<anonymous>)
at http://{site address}/wp-includes/js/dist/editor.min.js?ver=9.7.5:11:66861
at je (http://{site address}/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:78:476)
at qe (http://{site address}/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:89:115)
at ph (http://{site address}/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:216:489)
at lh (http://{site address}/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:126:409)
at O (http://{site address}/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:121:71)
at ze (http://{site address}/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:118:14)
at http://{site address}/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:53:49

To reproduce
Steps to reproduce the behavior:

  1. Create a custom post type with the following arguments
    • hierarchical: true
    • supports: array( 'page-attributes', 'editor', 'thumbnail', 'comments', 'post-formats' )
  2. Go to Add New for the created custom post type and wait for several seconds.
  3. The error message box appears.

Expected behavior
The editor should not crush, Instead, it should load the Page Attributes section properly.

Screenshots
image

Additional context

  • The crush seems to occur when the page selecting drop-down list in the Page Attribute section is going to be loaded as it has to list the posts with their titles.

I suggest not using the drop-down list with tons of posts there but placing an auto-complete input field. This also helps for situations with thousands of posts.

Activity

  1. added
    [Type] BugAn existing feature does not function as intended
    and removed
    Needs TestingNeeds further testing to be confirmed.
    on Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions