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

MWPW-158407, 158404, 158406, 158408, 158461: Ignoring decorateMeta if the metadata is from promo. #2924

Merged
merged 3 commits into from
Oct 1, 2024

Conversation

@seanchoi-dev seanchoi-dev requested a review from a team as a code owner September 19, 2024 22:00
Copy link
Contributor

aem-code-sync bot commented Sep 19, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@seanchoi-dev seanchoi-dev added the run-nala Run Nala Test Automation against PR label Sep 19, 2024
Copy link

codecov bot commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.37%. Comparing base (1791eb8) to head (488b691).
Report is 42 commits behind head on stage.

Additional details and impacted files
@@            Coverage Diff             @@
##            stage    #2924      +/-   ##
==========================================
+ Coverage   96.24%   96.37%   +0.12%     
==========================================
  Files         236      243       +7     
  Lines       54278    55122     +844     
==========================================
+ Hits        52241    53122     +881     
+ Misses       2037     2000      -37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seanchoi-dev seanchoi-dev changed the title Ignoring decorateMeta if the metadata is from promo. MWPW-158407: Ignoring decorateMeta if the metadata is from promo. Sep 19, 2024
libs/utils/utils.js Outdated Show resolved Hide resolved
Copy link
Contributor

This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried. If a test absolutely can not pass for a good reason, please add a comment with an explanation to the PR.

@@ -1147,7 +1147,7 @@ function decorateMeta() {
const { origin } = window.location;
const contents = document.head.querySelectorAll(`[content*=".${SLD}."]`);
contents.forEach((meta) => {
if (meta.getAttribute('property') === 'hlx:proxyUrl') return;
if (meta.getAttribute('property') === 'hlx:proxyUrl' || meta.getAttribute('name').endsWith('schedule')) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there any other meta names with this issue, other than "schedule"? We might be in a situation where someone else has another schedule referencing a URL and they will be forced to update the meta name. If this is just <meta name="schedule"> we're interested in, could we:

Suggested change
if (meta.getAttribute('property') === 'hlx:proxyUrl' || meta.getAttribute('name').endsWith('schedule')) return;
if (meta.getAttribute('property') === 'hlx:proxyUrl' || meta.getAttribute('name') === 'schedule') return;

Copy link
Contributor Author

@seanchoi-dev seanchoi-dev Sep 24, 2024

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

yes it can be emea_schedule too :) endswith('schedule') seems good to me

Copy link
Contributor

Choose a reason for hiding this comment

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

Should it possibly be .endsWith('_schedule') or make it more explicit with .endsWith('_promo_schedule')?

Copy link
Contributor Author

@seanchoi-dev seanchoi-dev Sep 27, 2024

Choose a reason for hiding this comment

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

I think the answer is NO since the issue case (US homepage) is showing just schedule w/o prefix.
image

Copy link
Contributor

@3ch023 3ch023 Oct 1, 2024

Choose a reason for hiding this comment

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

confirming that .endsWith('_schedule') will not be enough since we also need to ignore 'schedule' itself.
I updated the doc with all possible variations of this metadata: https://milo.adobe.com/docs/authoring/metadata (see end of table)

We might be in a situation where someone else has another schedule referencing a URL and they will be forced to update the meta name.

I understand, but as of now I am not able to find such a field (checked code and https://milo.adobe.com/docs/authoring/metadata). + It is rather unlikely that the field containing a 'pure' URL would end with a 'schedule' in the name.
If we find such a field we could switch to the exact check of === instead of endsWith, but it will cost more bytes in code.

From my side it's ok to leave it as .endsWith('schedule').

@seanchoi-dev seanchoi-dev changed the title MWPW-158407: Ignoring decorateMeta if the metadata is from promo. MWPW-158407, 158404, 158406, 158408, 158461: Ignoring decorateMeta if the metadata is from promo. Sep 25, 2024
Copy link
Contributor

aem-code-sync bot commented Sep 27, 2024

Page Scores Audits Google
📱 /?martech=off&georouting=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /?martech=off&georouting=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

@3ch023 3ch023 left a comment

Choose a reason for hiding this comment

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

approving the code change, but Nala tests are failing and need to be looked at.
From the brief check I wouldn't expect the change to cause it, but please double check

@afmicka
Copy link
Contributor

afmicka commented Oct 1, 2024

@3ch023 @seanchoi-dev replace fragment promo is breaking the page on this branch. There might be some stale blocks on the branch or there might be the real issue. The page loads blank:
https://mwpw-158407--milo--adobecom.hlx.page/drafts/nala/features/promotions/promo-with-fragments

Expected (main): https://main--milo--adobecom.hlx.page/drafts/nala/features/promotions/promo-with-fragments

As far as i can see, the error reported comes from the changed file
Screenshot 2024-10-01 at 15 30 22

@seanchoi-dev
Copy link
Contributor Author

@3ch023 @seanchoi-dev replace fragment promo is breaking the page on this branch. There might be some stale blocks on the branch or there might be the real issue. The page loads blank: https://mwpw-158407--milo--adobecom.hlx.page/drafts/nala/features/promotions/promo-with-fragments

Expected (main): https://main--milo--adobecom.hlx.page/drafts/nala/features/promotions/promo-with-fragments

As far as i can see, the error reported comes from the changed file Screenshot 2024-10-01 at 15 30 22

I fixed the js error.

@milo-pr-merge milo-pr-merge bot merged commit 6cdc02a into stage Oct 1, 2024
18 checks passed
@milo-pr-merge milo-pr-merge bot deleted the MWPW-158407 branch October 1, 2024 20:11
@milo-pr-merge milo-pr-merge bot mentioned this pull request Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for Stage run-nala Run Nala Test Automation against PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants