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

Closes #6604 Add fetch priority to LCP when url is relative #6626

Merged
merged 11 commits into from
May 27, 2024

Conversation

Khadreal
Copy link
Contributor

@Khadreal Khadreal commented May 9, 2024

Description

Fixes #6604

Documentation

Modify the regex pattern, to capture all possible cases, absolute, relative and other valid urls

User documentation

Explain how this code impacts users.

Technical documentation

Explain how this code works. Diagram & drawings are welcomed.

Type of change

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

New dependencies

N/A

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.

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.

Copy link

codacy-production bot commented May 9, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 2b088a31 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (2b088a3) Report Missing Report Missing Report Missing
Head commit (975369e) 37190 14427 38.79%

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 (#6626) 10 10 100.00%

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

Codacy will stop sending the deprecated coverage status from June 5th, 2024. Learn more

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.

@Khadreal Khadreal changed the title :chore: Add fetch priority to LCP when url is relative Closes #6604 Add fetch priority to LCP when url is relative May 10, 2024
@Khadreal Khadreal marked this pull request as ready for review May 13, 2024 11:04
@Khadreal Khadreal requested a review from a team May 13, 2024 11:05
@Khadreal Khadreal self-assigned this May 14, 2024
Copy link
Contributor

@wordpressfan wordpressfan left a comment

Choose a reason for hiding this comment

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

Good job, just small enhancements

inc/Engine/Media/AboveTheFold/Frontend/Controller.php Outdated Show resolved Hide resolved
inc/Engine/Media/AboveTheFold/Frontend/Controller.php Outdated Show resolved Hide resolved
Copy link
Contributor

@wordpressfan wordpressfan left a comment

Choose a reason for hiding this comment

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

Good job

@Mai-Saad
Copy link

Mai-Saad commented May 17, 2024

@Khadreal thanks for the PR. Working for the main shared template, and not adding fetchpriority in some edge cases as per exploratory testing below (not working with absolute URL too and same on trunk):

  1. If the relative URL has fetchpriority='high' in the URL <img src="/wp-content/rocket-test-data/images/fetchpriority='high'.jpg">
  2. If src was capital or has 1st letter capital or has space after it (If instead of src="imageURL" , SRC or Src or src = "imageURL")
  3. If a commented exact markup was 1st on page, fetchpriority will be added to the commented markup instead of active one
<!-- <img src="/wp-content/rocket-test-data/images/lcp/testavif.avif"> -->

		<img src="/wp-content/rocket-test-data/images/lcp/testavif.avif">
  1. LCP Image with Fetchpriority in markup, will have fetchpriority='high' and that will cause markup error. Example <img src="https://new.rocketlabsqa.ovh/wp-content/rocket-test-data/images/lcp/testavif.avif" fetchpriority> => seems regression and not on trunk @Khadreal can you please check?

@piotrbak Do you think we need GH for any of those cases 1-3?

@piotrbak
Copy link
Contributor

@Mai-Saad I think those are edge cases, we should be good here

@Mai-Saad
Copy link

@Khadreal
Copy link
Contributor Author

@Mai-Saad handle the regression and 1 and 2 edge cases. We keep looking on how to resolve the 3rd one. You can do another test when you have some time.

@Khadreal
Copy link
Contributor Author

@Mai-Saad I have added a fix for scenario 3 when there's a commented exact markup.

Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 2b088a31 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (2b088a3) Report Missing Report Missing Report Missing
Head commit (a55ac72) 37182 14376 38.66%

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 (#6626) 12 12 100.00%

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

Codacy will stop sending the deprecated coverage status from June 5th, 2024. Learn more

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.

Copy link

@Mai-Saad Mai-Saad left a comment

Choose a reason for hiding this comment

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

Working fine now
testrail-report-606.pdf

@Mai-Saad Mai-Saad added this pull request to the merge queue May 27, 2024
Merged via the queue into develop with commit 58962d2 May 27, 2024
14 checks passed
@Mai-Saad Mai-Saad deleted the fix/fetchpriority-lcp#6604 branch May 27, 2024 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fetchpriority of LCP is not applied on the LCP markup when the LCP URL is relative
4 participants