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

refactor: use window.location as base for url construction #303

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fkakatie
Copy link
Member

@fkakatie fkakatie commented Dec 7, 2023

Replaces instances of creating URL objects with a single argument with the two-argument form, using window.location as the base URL. Ensures that relative URLs are resolved against the current browser location for consistent handling.

Test URLs:

Copy link

aem-code-sync bot commented Dec 7, 2023

Hello, I'm the AEM Code Sync Bot and I will run some test suites that validate the page speed.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-run PSI Checks

Copy link

aem-code-sync bot commented Dec 7, 2023

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@@ -10,7 +10,7 @@ export default async function decorate(block) {
block.textContent = '';

// load footer fragment
const footerPath = footerMeta.footer || '/footer';
const footerPath = footerMeta ? new URL(footerMeta, window.location).pathname : '/footer';
Copy link

Choose a reason for hiding this comment

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

This also fixes the bug (#264) with footerMeta now being a string and not an object so footerMeta.footer can never be valid.

@Buuhuu
Copy link
Contributor

Buuhuu commented Apr 19, 2024

@fkakatie this has now been done with #346

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.

None yet

4 participants