FlatTermSelector
crashes editor: Can't access property "map", terms is null
#41095
Labels
General Interface
Parts of the UI which don't fall neatly under other labels.
[Type] Bug
An existing feature does not function as intended
Description
In some circumstances the
FlatTermSelector
component can crash the editor with the errorUncaught TypeError: can't access property "map", terms is null
.The line throwing the error is
gutenberg/packages/editor/src/components/post-taxonomies/flat-term-selector.js
Lines 180 to 182 in d602f50
I am only seeing it intermittently but it appears to happen with a registered terms REST API endpoint returns an unexpected result.
In my case a request to
/wp-json/wp/v2/taxonomies?context=edit&per_page=100&_locale=user
includes a reference to a taxonomy endpoint that subsequently throws a 404 error. Eg/wp-json/wp/v2/some-custom-taxo?context=view&per_page=100&orderby=count&order=desc&_fields=id%2Cname&include=21%2C26&_locale=user
throws a 404.I suspect
FlatTermSelector
requires a logic check to ensure the terms endpoint returns expected data before processing it.Step-by-step reproduction instructions
TBA
I'm still working on reproducing this with a plugin consistently. I'm only getting intermittent errors at the moment.
Screenshots, screen recording, code snippet
Error messages
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: