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

Fix/update default fetched links to 10 and parse unappended url to is home #6563

Conversation

jeawhanlee
Copy link
Contributor

@jeawhanlee jeawhanlee commented Apr 16, 2024

Description

Fetches 10 links from home plus home(11) and also fixes the is_home not detecting the homepage.

Fixes: Addresses @hanna-meda comment here and here

Documentation

User documentation

Explain how this code impacts users.

Technical documentation

public function add_to_atf_queue( string $url ): array {

We now save the original url before appending the query strings then reuse the version in is_home method
Also we now filter out the home url from the links if it exists and append in the end just before returning the urls, reason for this is to always return the home url for templates that might not contain the home url.

Type of change

  • Bug fix (non-breaking change which fixes an issue).

New dependencies

None

Risks

List possible performance & security issues or risks, and explain how they have been mitigated.

Checklists

Feature validation

  • I validated all the Acceptance Criteria. If possible, provide sreenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Documentation

  • I prepared the user documentation for the feature/enhancement and shared it in the PR or the GitHub issue.
  • The user documentation covers new/changed entry points (endpoints, WP hooks, configuration files, ...).
  • I prepared the technical documentation if needed, and shared it in the PR or the GitHub issue.

Code style

  • I wrote self-explanatory code about what it does.
  • I wrote comments to explain why it does it.
  • I named variables and functions explicitely.
  • I protected entry points against unexpected inputs.
  • I did not introduce unecessary complexity.
  • I listed the introduced external dependencies explicitely on the PR.
  • I validated the repo-specific guidelines from CONTRIBUTING.md.

Observability

  • I handled errors when needed.
  •  I wrote user-facing messages that are understandable and provide actionable feedbacks.
  • I prepared ways to observe the implemented system (logs, data, etc.).

Risks

  •  I explicitely mentioned performance risks in the PR.
  • I explicitely mentioned security risks in the PR.

@jeawhanlee jeawhanlee self-assigned this Apr 16, 2024
@jeawhanlee jeawhanlee added type: bug Indicates an unexpected problem or unintended behavior lcp labels Apr 16, 2024
Copy link

codacy-production bot commented Apr 16, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for e31b05b1 71.43% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e31b05b) Report Missing Report Missing Report Missing
Head commit (0328cda) 36824 8216 22.31%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#6563) 7 5 71.43%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@jeawhanlee jeawhanlee requested a review from a team April 16, 2024 17:13
@jeawhanlee jeawhanlee marked this pull request as ready for review April 16, 2024 17:13
inc/Engine/Media/AboveTheFold/WarmUp/Controller.php Outdated Show resolved Hide resolved
@@ -24,7 +26,7 @@ public function add_to_atf_queue( string $url ): array {

$config = [
'optimization_list' => '',
'is_home' => Utils::is_home( $url ),
'is_home' => $is_home,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I believe it is, in reference to @hanna-meda comment here

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm failing to understand the difference it makes, it's the same code assigned to a variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes but we are now preserving the original state of the url param which was not the case before as we alter the state here first then we use it here which in the is_home method here we will always return false even if it's the home page because it's now appended with a query string i.e example.org?wpr_imagedimensions=1

Copy link
Contributor

Choose a reason for hiding this comment

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

ah yes right, I see now, all good

@jeawhanlee jeawhanlee requested a review from remyperona April 17, 2024 10:29
@jeawhanlee jeawhanlee merged commit 5d51e47 into feature/lcp-above-the-fold-optimization Apr 18, 2024
12 checks passed
@jeawhanlee jeawhanlee deleted the fix/update-default-fetched-links-to-10-and-parse-unappended-url-to-is-home branch April 18, 2024 09:56
@hanna-meda hanna-meda self-assigned this Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants