Skip to content
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

Various: Use wp_resource_hints #16305

Merged
merged 4 commits into from
Jul 9, 2020
Merged

Various: Use wp_resource_hints #16305

merged 4 commits into from
Jul 9, 2020

Conversation

kraftbj
Copy link
Contributor

@kraftbj kraftbj commented Jun 26, 2020

Closes #10352 ( props @willstocks )
Fixes #4838
Fixes #8090 ( This does not create a filter, but rather utilizes the existing WP filter that can be used for the ends requested in that issue. ).

When Jetpack::dns_prefetch was included, WordPress did not have a native solution, which was implemented awhile ago now.

Changes proposed in this Pull Request:

  • Uses the Core provided functionality for wp_resource_hints instead of rolling out own.

Jetpack product discussion

n/a

Does this pull request change what data or activity we track or use?

No.

Testing instructions:

  • Enable various modules (Comments, Comment Likes, Photon).
  • View the <head> of a front-end page. Ensure the various Jetpack-related domains are present as <link rel="dns-prefetch"...>

Proposed changelog entry for your changes:

  • Performance: Use WordPress-provided wp_resource_hints for DNS prefetching.

@kraftbj kraftbj added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Comments [Feature] Likes [Feature] Photon aka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins [Status] Needs Review To request a review from Crew. Label will be renamed soon. [Feature] Comment Likes labels Jun 26, 2020
@kraftbj kraftbj added this to the 8.8 milestone Jun 26, 2020
@kraftbj kraftbj self-assigned this Jun 26, 2020
@github-actions github-actions bot added the [Status] Needs Package Release This PR made changes to a package. Let's update that package now. label Jun 26, 2020
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello kraftbj! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D45584-code before merging this PR. Thank you!
This revision will be updated with each commit to this PR

@jetpackbot
Copy link

jetpackbot commented Jun 26, 2020

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-16305

Scheduled Jetpack release: July 7, 2020.
Scheduled code freeze: June 30, 2020

Generated by 🚫 dangerJS against 1b5a0d0

@kraftbj kraftbj added [Status] In Progress and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jun 27, 2020
@kraftbj kraftbj added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] In Progress labels Jun 29, 2020
@kraftbj
Copy link
Contributor Author

kraftbj commented Jun 29, 2020

The WP.com side diff is not needed; will be handled part of a larger work to get Likes back in sync.

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if maybe we could take that opportunity to move this to the Assets package. What do you think?

@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jul 2, 2020
@kraftbj
Copy link
Contributor Author

kraftbj commented Jul 3, 2020

@jeherve I hadn't considered that. Yeah, let's get something else out of the mega class.

@kraftbj kraftbj added [Status] In Progress and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Jul 3, 2020
@kraftbj
Copy link
Contributor Author

kraftbj commented Jul 3, 2020

I moved it to the Assets package. I'm wresting around with how to have a suitable unit test for it.

@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello kraftbj! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D45967-code before merging this PR. Thank you!
This revision will be updated with each commit to this PR

@kraftbj kraftbj added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] In Progress labels Jul 6, 2020
Copy link
Member

@jeherve jeherve left a 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, it should be good to merge. I only have one question, but that's really nothing super important.

'//i1.wp.com',
'//i2.wp.com',
) );
\Automattic\Jetpack\Assets::add_resource_hint(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason why you did it this way for this module and for VideoPress, vs. calling use at the top of the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just since it was the only usage in that file and likely to always be the only usage given that the module file doesn't do much.

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jul 9, 2020
@kraftbj kraftbj merged commit 8720fd3 into master Jul 9, 2020
@kraftbj kraftbj deleted the update/resource_hints branch July 9, 2020 19:17
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Jul 9, 2020
@jeherve jeherve added [Status] Has Changelog and removed [Status] Needs Changelog [Status] Needs Package Release This PR made changes to a package. Let's update that package now. labels Jul 28, 2020
@anomiex anomiex mentioned this pull request Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Comment Likes [Feature] Comments [Feature] Likes [Feature] Photon aka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins Touches WP.com Files [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a filter for dns_prefetch links Update Jetpack DNS Prefetch to use 4.6 Resource Hints
4 participants