Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 798 forks source link

Boost: WP_Core_Provider::get_critical_source_urls() returns home url twice in some cases #27826

Open dilirity opened 1 year ago

dilirity commented 1 year ago

Impacted plugin

Boost

Steps to Reproduce

  1. Go to WP-admin -> Settings -> Reading
  2. Set a Homepage and leave Posts page blank (or select the same page for both Homepage and Posts page)
  3. Add the following snippet to your theme's functions.php
add_action( 'template_redirect', function () {
    print_r(\Automattic\Jetpack_Boost\Lib\Critical_CSS\Source_Providers\Providers\WP_Core_Provider::get_critical_source_urls());
    exit;
} );
  1. Open any page in the front-end to see the result

A clear and concise description of what you expected to happen.

The home URL should be present only once (not a 100% sure about this, as I'm not familiar with Critical CSS generation that much).

What actually happened

The home URL appears twice in the list (though under a different key).

Browser

No response

Other information

No response

Platform (Simple, Atomic, or both?)

Atomic, Self-hosted

Reproducibility

Consistent

Severity

All

Available workarounds?

No but the platform is still usable

Workaround details

No response

dilirity commented 1 year ago

@pyronaur while working on https://github.com/Automattic/jetpack/pull/27497 I noticed the Home url was returned twice so I opened this issue. Could you comment on whether it's intended to have the home url twice under a different key, or is it a bug?

pyronaur commented 1 year ago

Yeah, that looks like a bug. If you're taking it up - ensure that Critical CSS is still getting generated for the various home-page configurations and is also used on the front-end.