-
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
Lazy Images: remove from Jetpack plugin #33782
Conversation
Fixes #33171 We deprecated the feature and issued notices to our users still using it in #33208. It is now time to remove it entirely. - If the module is still enabled, we disable it. - We do not display the feature in any of our UI elements anymore. - We declare the file as deprecated, so we can safely remove it in a future version of the plugin.
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. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. 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.
Works as advertised.
I did a search looking for other references to lazy image loading. I suppose these things need to wait until it's removed from Boost too?
- Image CDN package support for our lazy-images feature:
jetpack/projects/packages/image-cdn/src/class-image-cdn.php
Lines 379 to 391 in ce0c812
// Support Automattic's Lazy Load plugin. // Can't modify $tag yet as we need unadulterated version later. if ( preg_match( '#data-lazy-src=["\'](.+?)["\']#i', $images['img_tag'][ $index ], $lazy_load_src ) ) { $placeholder_src_orig = $src; $placeholder_src = $placeholder_src_orig; $src_orig = $lazy_load_src[1]; $src = $src_orig; } elseif ( preg_match( '#data-lazy-original=["\'](.+?)["\']#i', $images['img_tag'][ $index ], $lazy_load_src ) ) { $placeholder_src_orig = $src; $placeholder_src = $placeholder_src_orig; $src_orig = $lazy_load_src[1]; $src = $src_orig; } jetpack/projects/packages/image-cdn/src/class-image-cdn.php
Lines 572 to 581 in ce0c812
// If Lazy Load is in use, pass placeholder image through Photon. if ( isset( $placeholder_src ) && self::validate_image_url( $placeholder_src ) ) { $placeholder_src = Image_CDN_Core::cdn_url( $placeholder_src ); if ( $placeholder_src !== $placeholder_src_orig ) { $new_tag = str_replace( $placeholder_src_orig, esc_url( $placeholder_src ), $new_tag ); } unset( $placeholder_src ); } jetpack/projects/packages/image-cdn/src/js/image-cdn.js
Lines 8 to 14 in ce0c812
// Support for lazy loading: if there is a lazy-src attribute and it's value // is not the same as the current src we should wait until the image load event const lazySrc = this.getAttribute( 'data-lazy-src' ); if ( lazySrc && this.src !== lazySrc ) { this.addEventListener( 'onload', recalculate ); return; }
- Adding "abandoned" to
projects/packages/lazy-images/composer.json
, and an appropriate notice in the readme.- Then after publishing a final version we can delete it from the monorepo and archive https://github.com/Automattic/jetpack-lazy-images
- Boost-related reference in my-jetpack:
jetpack/projects/packages/my-jetpack/src/products/class-boost.php
Lines 180 to 196 in ce0c812
array( 'name' => __( 'Lazy image loading', 'jetpack-my-jetpack' ), 'info' => array( 'content' => __( 'Improve page loading speed by only loading images when they are required.', 'jetpack-my-jetpack' ), 'link' => array( 'id' => 'jetpack-boost-lazy-load', 'title' => 'web.dev', ), ), 'tiers' => array( self::FREE_TIER_SLUG => array( 'included' => true ), self::UPGRADED_TIER_SLUG => array( 'included' => true ), ), ), - Boost-related reference at
__( 'Lazy image loading and site performance scores', 'jetpack' ),
Also I wonder whether https://github.com/Automattic/jetpack/blob/rm/lazy-images-jetpack/projects/packages/search/src/instant-search/components/photon-image.jsx, which looks like it does its own lazy loading, should be changed to just use loading="lazy"
too.
Yes, once we do not use the Lazy Images package anywhere anymore, we'll be able to completely remove everything and properly deprecate the package. This is tracked in the primary issue: #33048.
That's a good point. @jsnmoon Looks like you worked on #19269 back in the day. Do you think we could remove this in favor of the loading attribute now? |
The module was deprecated in #33782. We can now safely remove the module from the plugin.
The module was deprecated in #33782. We can now safely remove the module from the plugin.
Now that we require WordPress 6.5, we can remove any backwards-compatibility checks for folks that run WP 6.4. I also cleaned up some older stuff while I was looking. * js-packages/components: Remove a deprecation kept for 6.4 compat. * packages/jetpack-mu-wpcom: Simplify a test. * plugins/jetpack: Remove unnecessary `version_compare()` calls, assume WP 6.5+. * plugins/jetpack: Remove a check for us being Jetpack >=5.3. * plugins/jetpack: Remove some code checking for `JSON_BIGINT_AS_STRING` support, which was added in PHP 5.4. * plugins/jetpack: Address some `@todo` comments calling for action once WP 6.5 is the minimum. * plugins/jetpack: Remove support code for a feature removed in #33782 * plugins/wpcomsh: Remove unnecessary `version_compare()` calls, assume WP 6.5+. * plugins/wpcomsh: Remove some checks for old Jetpack versions. * plugins/wpcomsh: Remove a polyfill for WordPress before 5.4. * cli: Update some code for node 20.1+.
Fixes #33171
Proposed changes:
We deprecated the feature and issued notices to our users still using it in #33208. It is now time to remove it entirely.
Other information:
Let's also take that opportunity to close related issues:
Fixes #10016
Fixes #9827
Fixes #24002
Fixes #9043
Fixes #11054
Fixes #8905
Fixes #17640
Fixes #15073
Fixes #16421
Fixes #8879
Fixes #9509
Fixes #9974
Fixes #9896
Fixes #8917
Fixes #10046
Fixes #8897
Fixes #9929
Fixes #9595
Fixes #10606
Fixes #12344
Fixes #10607
Fixes #25659
Fixes #29585
Fixes #14191
Fixes #13518
Fixes #10707
Fixes #8996
Fixes #8773
Fixes #8281
Fixes #14161
Fixes #31877
Fixes #14281
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
trunk
, using the Lazy Images module: connect your site to WordPress.com, and in WP CLI, enable the module (you cannot enable it via the UI anymore):wp jetpack module activate lazy-images
wp jetpack module list