Check for fetchpriority feature being available in WordPress core before loading the module#769
Merged
mukeshpanchal27 merged 2 commits intotrunkfrom Jul 3, 2023
Merged
Conversation
kt-12
approved these changes
Jun 30, 2023
Member
kt-12
left a comment
There was a problem hiding this comment.
Thank you @felixarntz. LGTM!.
Just an observation, since we are not forcefully disabling fetchpriority for standalone plugin, there can be a chance of having 2 fetchpriority in a page - If the post thumbnail is less than the 50000px threshold, but one of the first 3 content image is larger than the threshold ( a very rare edge case )
Member
Author
|
@kt-12 Fair point, thanks for raising. I think that's okay though, also given that the standalone plugin currently only has 20+ installs. |
mukeshpanchal27
approved these changes
Jul 3, 2023
Member
mukeshpanchal27
left a comment
There was a problem hiding this comment.
Thanks @felixarntz for the PR, Look good to me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR checks for existence of the fetchpriority feature in WordPress core, which was merged earlier this week and will become widely available with the WordPress 6.3 launch in August (see https://core.trac.wordpress.org/ticket/58235). We should therefore ensure before that release that Performance Lab caters for that situation.
Relevant technical choices
can-load.phpfile is added, the default mechanism to check whether a module can be loaded, with the closure returningfalsewhen the WP core version on the site already provides the feature.can-load.phpfile is irrelevant, therefore the PR adds an admin notice closure which is only shown for the standalone plugin (based on the specific constant check).readme.txthas been updated and the standalone plugin version is bumped to 1.1.0. This will automatically be published together with the next Performance Lab plugin release on July 17.Screenshots
Performance Lab module checkbox when feature already in core

Admin notice for standalone plugin when feature already in core

Checklist
[Focus]orInfrastructurelabel.[Type]label.no milestonelabel.