Block Editor: Optimize resizable preview hooks#22511
Conversation
|
Size Change: +10 B (0%) Total Size: 1.12 MB
ℹ️ View Unchanged
|
tellthemachines
left a comment
There was a problem hiding this comment.
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,
useSimulatedMediaQueryis 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.