-
Notifications
You must be signed in to change notification settings - Fork 843
Block editor: Hotfix performance regression #41309
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
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
jeherve
left a comment
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.
This tests well for me. I would have a couple of last remarks, but no blockers:
- What would you think about making the function name,
jetpack_hotfix_block_editor_script, a bit more specific about the versions / the problem it targets, so we know what this was about in a few years. Maybe the docblock could include more information? - Maybe that docblock could mention how the min. files were created? Or maybe just point to this PR for more information?
- The file is currently loaded even if Jetpack is not connected to WordPress.com yet, or if Jetpack's own block bundle is not loaded because the feature has been disabled. I think that's fine, the hotfix would benefit everyone anyway, but I wanted to make sure that was intentional.
- In #41333 we ship the hotfix only in mu-wpcom. If the performance impact touches everyone, regardless of the platform, I think it makes sense to ship it in Jetpack for now, but maybe there should be a clearer way for folks reviewing changes like this to understand why a hotfix goes in one plugin vs. the other.
|
Looks like a fix for this is coming upstream, I wonder if it's worth keeping. |
We pinned Gutenberg v20 in Dotcom, so unless we revert that decision, I think we're going to need this hotfix. See p9oQ9f-2Bq-p2#comment-3374 |
Good callout. Renamed the function and updated the docblock in b02606a
Definitely, not intentional. Although the issue is indeed affecting everyone, is almost unnoticeable if the site doesn't have a plugin registering additional blocks. Since Jetpack is one of these plugins, I think it'd be better to target this hotfix to only when the Jetpack blocks are available. In e22639a, I included an additional check for that.
Yup, I'm aware of this inconsistency. I don't know why #41333 only hotfixed Dotcom sites, maybe the issue was specific to Dotcom sites. If that's not the case, I think we should apply to Jetpack sites too (cc @fushar). I briefly mentioned this too in p9oQ9f-2Bq-p2#comment-3374, since we're going to need more alignment with other folks (e.g. WooCommerce). |
My understanding is that we need to hotfix to Dotcom (only) because the GB version is pinned there. Other hosts are free to upgrade the GB plugin whenever a fix is available upstream. Am I missing something? |
That makes sense, yeah. Self-hosted sites are also more unlikely to have the Gutenberg plugin active. I guess I lost perspective because I started to work on this before the issue was fixed upstream, so I was considering a worst-case scenario where the issue was solved in the short term. I'll move the changes here to |
anomiex
left a comment
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'll move the changes here to jetpack-mu-wpcom.
Glad I looked at the comments before suggesting exactly that! 👍 😀
Even better would be to bump Gutenberg to a fixed version before freezing it, but 🤷.
anomiex
left a comment
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.
Looks reasonable to me, assuming we won't update Gutenberg directly to v20.2.0 on wpcom.
Haven't tested it myself though.
dsas
left a comment
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.
Tests fine on atomic for me, I can't repro the original issue with child blocks either. I can't repro the slowness on simple.
Perhaps we should commit the original source file here as well as the minified ones but given the hotfix is already merged upstream I guess it's unlikely to be useful.
|
I've been thinking about this change and I'm a bit concerned about it. the main issue is that people are going to use Jetpack with future Gutenberg versions that might introduce new functions and APIs to the block-editor package. When that happens, Jetpack will replace block-editor with an old patched version which means potential breakage. So unless we keep patching this package with every Gutenberg release, it's going to be very hard to keep this fix in place. Given that the fix landed in Gutenberg upstream, I think we should just revert this PR. |
In the end, the fix isn't in Jetpack at all. It's in the mu-wpcom package that's only intended for use in Simple and Atomic.
I note the fix here checks for specific Gutenberg versions. Later versions won't be replaced. jetpack/projects/packages/jetpack-mu-wpcom/src/features/wpcom-hotfixes/wpcom-hotfixes.php Lines 69 to 71 in ba9862b
|
I had missed that, that eases my concerns a bit. Thank you. |
Fixes Automattic/wp-calypso#98377
See p1737631296756739-slack-C02FMH4G8
Proposed changes:
Overrides the
wp-block-editorscript with a custom version that includes these changes (props to @youknowriad):This way, we can prevent a performance degradation that started with WordPress/gutenberg#67734 which is currently present in Gutenberg v19.9.0, v20.0.0, and v20.1.0, and particularly on plugins that register blocks like Jetpack or WooCommerce.
This is especially relevant for Dotcom sites since the Gutenberg version has been pinned to v20.0.0 and there are no plans currently to update it (p58i-jaO-p2).
The custom
wp-block-editorscript has been built for each of the affected Gutenberg versions.Before
Screen.Recording.2025-01-24.at.17.37.57.mov
After
Screen.Recording.2025-01-24.at.18.19.47.mov
Other information:
Jetpack product discussion
N/A
Does this pull request change what data or activity we track or use?
No
Testing instructions: