Template Part: Fix site editor error when loading with list view set to always display#58868
Conversation
…to always display
|
Size Change: +3 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 71087df. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7838377238
|
tellthemachines
left a comment
There was a problem hiding this comment.
LGTM, thanks for fixing this! Loading the site editor with list view always visible no longer errors.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Thanks for the quick review! 🙇 |
|
Thank you, @andrewserong! |
What?
Follows #58644
Fix a site editor error when opening the site editor with the list view set to always display ("Always open list view" in preferences)
Why?
When initially loading, until an entity object is properly resolved, the entity object appears to be an empty object, so
capitalCasewas being called withundefinedwhich throws an error.How?
If
entity.slugis not present, fallback to an empty string to avoidcapitalCasethrowing an errorTesting Instructions
In the site editor, open the preferences and set
Always open list viewand then do a full page reload the site editor in canvas mode, i.e:/wp-admin/site-editor.php?canvas=editOn
trunkif your template has Header or Footer template parts, there'll be an error.With this PR applied there should be no error
Testing Instructions for Keyboard
Screenshots or screencast
The error: