Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions blocks/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
fetchLangDatabyFileName,
} from '../../scripts/scripts.js';
import {
getLanguage, PATH_PREFIX, fetchLanguageNavigation,
getLanguage, PATH_PREFIX,
} from '../../scripts/utils.js';
import * as constants from './constants.js';
import {
Expand Down Expand Up @@ -426,7 +426,6 @@ export default async function decorate(block) {
: `${PATH_PREFIX}/${langCode}/nav`;
const fragment = await loadFragment(navPath);
const placeholdersData = await fetchLanguagePlaceholders();
fetchLanguageNavigation(`/${langCode}`);

// decorate nav DOM
block.textContent = '';
Expand Down
2 changes: 2 additions & 0 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
setPageLanguage,
cookiePopUp,
showCookieConsent,
fetchLanguageNavigation,
PATH_PREFIX,
} from './utils.js';

Expand Down Expand Up @@ -239,6 +240,7 @@ export async function load404() {
async function loadEager(doc) {
setPageLanguage();
decorateTemplateAndTheme();
fetchLanguageNavigation(`/${getLanguage()}`);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@rrusher why It's important to call navigation in eager?

@thomsebastin thomsebastin Oct 23, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mkbansal1 I believe by the time header loads, navigation items will be ready. Now, weather to load it in lazy vs eager might be debatable. If loading it in eager isn't impacting the score (which I think it isn't looking at the score), then I think it is fine.

await createSkipToMainNavigationBtn();
await cookiePopUp();
renderWBDataLayer();
Expand Down