-
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
Editor: Avoid triggering the start page modal on unsaved pages #61082
Conversation
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. |
Size Change: +5 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
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.
Works as expected.
Fixes a bug raised here #60745 (comment)
What?
When we create a new page in the site editor, we're shown a modal to pick a starter content. If we pick some content and immediately navigate out of the page in the site editor with the unsaved changes, when we come back to the page, it was still considered "empty" which cause the modal to appear again even if the page was not really empty.
How?
It turns out that
editEntityRecod( { blocks } )
is not enough to change the return value of the over optimizedisEmptyEditedPost
. It seems that every time we call editEntityRecord with blocks, we're supposed to also call it with a function edit for the "content" to ensure that the save mechanism knows how to persist the blocks into content on save.Testing Instructions
1- Create a new page in the site editor
2- Choose a starter content in the modal
3- Click the site icon to leave the editor page
4- Click the preview frame again to go back to the editor
5- You shouldn't see the starter options modal again.