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

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

Closed
mipon opened this issue Dec 8, 2019 · 0 comments · Fixed by #19936
Assignees
Labels
[Type] Bug An existing feature does not function as intended

Comments

@mipon
Copy link

mipon commented Dec 8, 2019

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.

@talldan talldan added the Needs Testing Needs further testing to be confirmed. label Jan 24, 2020
@jorgefilipecosta jorgefilipecosta self-assigned this Jan 24, 2020
@jorgefilipecosta jorgefilipecosta added [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. labels Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants