-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Site Editor: Use the same editor component for all routes #69093
base: trunk
Are you sure you want to change the base?
Conversation
Size Change: -21 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
Flaky tests detected in e04dde8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/13197444965
|
@@ -23,6 +23,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router'; | |||
import { decodeEntities } from '@wordpress/html-entities'; | |||
import { Icon, arrowUpLeft } from '@wordpress/icons'; | |||
import { store as blockEditorStore } from '@wordpress/block-editor'; | |||
import { addQueryArgs } from '@wordpress/url'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the incorrect position of the import statement.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve tested and this works as expected. I think it’d be fine to land as is. I'm unsure that the branching for the home view is best put inside EditSiteEditor
. It seems like keeping it in the MaybeEditor
component and using that in all the routes might be better. Though in that case I think a better name could be found (something like MainFrame
—I was looking through #53322 in regards to this). However, I don’t see this as a pressing concern for now.
I wanted to mention in regards to #69016, this makes the problem go away and it’s fine with me if we keep it linked. I’ll still propose #69103 as a code quality improvement.
@stokesman Thanks for the review! I found out that this PR not only solves #69016, but also #69108. Should we merge this PR and then move on to #69103? |
What?
This PR uses the same editor component for all routes in the site editor, i.e. merge the
MaybeEditor
component logic into theEditSiteEditor
component.As a result, the issue reported in #69016 will be resolved.
Why?
Note: I'm not confident about the following explanation, so if I've misunderstood anything, please let me know.
In #66851, StyleBook for the classic theme was exposed. The
MaybeEditor
component was added to display the site preview instead of the regular editor in the home route.That is, depending on the route, the editor component will switch between
MaybeEditor
orEditSiteEditor
. This may break references to the previous entity, which can cause issues such as the Back button not appearing in the document title, as reported in #69016.How?
MaybeEditor
component.EditSiteEditor
component, render the site preview via thisSitePreview
component only if the conditions are met (it is the home root and not a block theme).Testing Instructions
Confirm that the editor, site preview, stylebook, etc. are displayed correctly in the following four scenarios:
Testing Instructions for #69016
6057fbd10dc65c7ee77797db5fca6d94.mp4