Skip to content

perf: defer and deprioritize Lingo Wave 2 cross-site index fetches#6209

Closed
mokimo wants to merge 1 commit into
stagefrom
mokimo-lingo-wave2-defer
Closed

perf: defer and deprioritize Lingo Wave 2 cross-site index fetches#6209
mokimo wants to merge 1 commit into
stagefrom
mokimo-lingo-wave2-defer

Conversation

@mokimo

@mokimo mokimo commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Description

On Lingo-active pages (e.g. `/fr/creativecloud`), `lingo-site-mapping.json` (0.9 KB) resolves in ~70 ms and immediately triggers 6 cross-site query-index fetches (Wave 2) while Wave 1's 45 KB + 26 KB primary/base indexes are still mid-download. On a 4G connection this bandwidth race delays Wave 1 completion by ~220 ms, pushing back the LCP image fetch start by the same amount.

Three changes in utils.js:

1. fetchOptions param on processQueryIndexMap
Adds an optional fetchOptions = {} argument passed straight to fetch(), so call-sites can independently control priority.

2. priority: 'low' on lingo-site-mapping fetch
The site-mapping file has no LCP dependency — it only triggers cross-site index discovery. Deprioritising it frees bandwidth for LCP-critical hero CSS/JS during the most sensitive render window.

3. Await Wave 1 before firing Wave 2
Inside the lingoSiteMapping IIFE, added:

await Promise.all(
  [queryIndexes[siteId]?.pathsRequest, baseQueryIndex?.pathsRequest].filter(Boolean),
);

before the Wave 2 forEach. Wave 2 now starts only after the 45 KB + 26 KB Wave 1 files have landed, eliminating the bandwidth race entirely on slow connections. Wave 2 calls also pass { priority: 'low' }.

Wave 1 is unchanged — fires immediately at default priority, required for LCP-section link localization.

Before (4G): Wave 2 fires at ~t+70 ms (site-mapping resolves), competing with Wave 1 still downloading its 71 KB.
After (4G): Wave 2 fires at ~t+295 ms (after Wave 1 lands), no overlap.

Resolves: MWPW-TBD

Test URLs (da-cc fr/creativecloud):

🤖 Generated with Claude Code

On Lingo-active pages (e.g. /fr/creativecloud), lingo-site-mapping.json
resolves quickly (~70ms) and immediately triggers 6 cross-site query index
fetches (Wave 2) while Wave 1's 45KB + 26KB files are still downloading.
On 4G this bandwidth race delays Wave 1 completion by ~220ms, pushing back
the LCP image fetch start.

Three changes:
- Add fetchOptions param to processQueryIndexMap so callers can control
  fetch priority independently.
- Fetch lingo-site-mapping.json with { priority: 'low' } — it has no LCP
  dependency and should not compete with hero CSS/JS.
- Await Wave 1 (primary + base pathsRequests) inside the lingoSiteMapping
  IIFE before firing the Wave 2 forEach, so cross-site indexes only start
  after the bandwidth-heavy Wave 1 files have landed. Wave 2 calls also
  pass { priority: 'low' }.

Wave 1 is unchanged — fires immediately at default priority for LCP section
link localization.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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

  • Re-sync branch
Commits

@mokimo

mokimo commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Closed in favor of #6210

@mokimo mokimo closed this Jun 22, 2026
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.

1 participant