-
Notifications
You must be signed in to change notification settings - Fork 806
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
i18n loader script: load script in the footer and defer it. #38929
Conversation
Related conversation: p55Cj4-3qL-p2
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! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
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 works, although it doesn't look like there's much point to the "defer" part since the existence of an "after" script will always disable it.
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.
Also, it might be worth doing similarly for the 'react-jsx-runtime' registered just below this.
@@ -729,7 +729,7 @@ function ( $v ) { | |||
|
|||
// @phan-suppress-next-line PhanDeprecatedFunction -- Keep using setMethods until we drop PHP 7.0 support. | |||
$mock = $this->getMockBuilder( \stdClass::class ) | |||
->setMethods( array( 'add', 'add_inline_script' ) ) | |||
->setMethods( array( 'add', 'add_inline_script', 'add_data' ) ) |
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.
Should we add some $mock->expects( ... )->method( 'add_data' )
to check that the proper calls were made for that too?
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.
Sure thing, good idea. Done in 1503ba4
It won't be needed: #38929 (review)
See #38929 (review) Co-authored-by: Brad Jorsch <[email protected]>
Good point. Removed in ec10133
👍 Done in 82fb0aa |
Significance: patch | ||
Type: changed | ||
|
||
i18n loader script: load script in the footer and defer it. |
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.
Update this?
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.
Good point. 2c1de55
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: Automattic/jetpack#38929 (review) * Also add react-jsx-runtime to be loaded in footer See Automattic/jetpack#38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See Automattic/jetpack#38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10469831354 Upstream-Ref: Automattic/jetpack@63cd636
* i18n loader script: load script in the footer and defer it. Related conversation: p55Cj4-3qL-p2 * Add 'add_data' mock * Remove defer strategy It won't be needed: #38929 (review) * Also add react-jsx-runtime to be loaded in footer See #38929 (review) Co-authored-by: Brad Jorsch <[email protected]> * Add test to ensure add_data is being called See #38929 (comment) * Update changelog --------- Co-authored-by: Brad Jorsch <[email protected]>
Proposed changes:
Let's load that script in the footer of the page to improve performance.
Other information:
Jetpack product discussion
Related conversation: p55Cj4-3qL-p2
Does this pull request change what data or activity we track or use?
Testing instructions:
wp-jp-i18n-loader
To test the changes to
react-jsx-runtime
, you'll need to run through the testing instructions in #38428.