-
Notifications
You must be signed in to change notification settings - Fork 799
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
Blaze: only enqueue script in post editor #28187
Conversation
Fixes #28184 1. We do not need Blaze in the site editor, since we cannot promote specific posts from there. 2. The Blaze panel relies on @wordpress/editor, which we cannot use in the site editor or the widget editor. 3. When we enqueue the Blaze panel in the site editor or the widget editor, we run into this issue: #20357. This causes Fatal errors just like the one we experienced and worked around in #21763. To solve this issue, we switch to using the admin_enqueue_scripts hook to decide whether when to enqueue our script. It allows us to conditionally enqueue the file based on the page we're on, which is something the enqueue_block_editor_assets hook does not allow yet.
Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run |
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. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. |
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 can confirm this fixes the site editor issue.
Cherry-picked to the release branch in ecd8f17 |
Looking for upstream assistance in ensuring this type of bug is harder to occur. WordPress/gutenberg#46900 and https://core.trac.wordpress.org/ticket/57421 (props @jeherve) |
Fixes #28184
Changes proposed in this Pull Request:
@wordpress/editor
, which we cannot use in the site editor or the widget editor.To solve this issue, we switch to using the
admin_enqueue_scripts
hook to decide whether when to enqueue our script. It allows us to conditionally enqueue the file based on the page we're on, which is something theenqueue_block_editor_assets
hook does not allow yet.Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: