-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Block Editor: Optimize resizable preview hooks #22511
Conversation
Size Change: +10 B (0%) Total Size: 1.12 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.
Thanks for fixing this @aduth!
We might have to revisit having Desktop as default if we implement Desktop previews on mobile devices but for now it's working very well.
Thanks @tellthemachines ! Regarding the default, as I was looking at the code, I also wonder if it's something where we can do more to disambiguate default from one of the specific states. I had some initial confusion in considering "Default" as in contrast to "Tablet" and "Mobile", likely because I was thinking of it more in the way of the comment you referenced at #13203 (comment) where "Desktop" could be a valid preview mode, even in a smaller device. In that case, we should probably want to more explicitly disambiguate the default neutral state. In some ways, I think these changes might help move a bit more in that direction, e.g. removing assumptions around specific canvas widths for the neutral state. Maybe a good next step could be to replace the |
Previously: #19082
This pull request seeks to optimize hooks used in rendering resizable previews. Currently,
useSimulatedMediaQuery
is the highest self-time spent during page load, despite only being relevant for use in the resizable previews:The changes in this pull request seek to try to do as much as possible to defer transforms and resize event handlers only when relevant (when using device preview modes).
Testing Instructions:
Repeat Testing Instructions from #19082, verifying there are no regressions.