-
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: do not remount iframe #46431
Conversation
@@ -257,8 +254,6 @@ export default function BlockEditor( { setIsInserterOpen } ) { | |||
<BlockEditorKeyboardShortcuts.Register /> | |||
<BackButton /> | |||
<ResizableEditor | |||
// Reinitialize the editor and reset the states when the template changes. | |||
key={ templateId } |
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.
If a reset in size is needed, we should be doing it inside the ResizableEditor
components and not remount the whole tree.
Size Change: -29 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
Indeed, switching templates is awesome in this PR 👏 Still testing edge cases |
The auto-resizing was introduced for Template Parts and their focus mode. It would be a good idea to test those for regressions. |
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.
Can find any issue with this 👍
The focus mode works as before 👍 |
Great! If there's any regression, let's not fix it by changing keys. :) |
FWIW, using keys to reset states is a common pattern documented in the official doc. It does remount the component but often times it's not that bad as it sounds. However, after some iterations, I don't think it's needed anymore (we no longer |
What?
This was added by #35974, but I can't see why it's necessary.
I did some testing and I can't see anything breaking.
It sounds like this was added to reset the height of the canvas, but I'm unable to find a case where it's needed.
Even if we need a reset there, we shouldn't be unmounting the whole iframe.
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast