Skip to content

MWPW-207641: prewarm only known blocks in LCP preload (fixes breadcrumbs 404) - #6733

Open
vhargrave wants to merge 3 commits into
stagefrom
vhargrave/MWPW-207641-breadcrumbs-preload-404
Open

vhargrave wants to merge 3 commits into
stagefrom
vhargrave/MWPW-207641-breadcrumbs-preload-404

Conversation

@vhargrave

@vhargrave vhargrave commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

What's wrong

bacom pages have been firing failed (404) network requests for breadcrumbs.js and breadcrumbs.css since ~Sep 10. Nothing looks broken on the page — the breadcrumbs still render — but every page load makes two requests for files that don't exist.

Why

PR #6643 added an LCP preloader that warms the code for every block in the page's first section. It assumes each element there is a normal block living at blocks/<name>/.

breadcrumbs breaks that assumption. It isn't a standalone block — the global nav moves it into the header and loads it from there, so there is no blocks/breadcrumbs/ file to fetch. The preloader didn't know that and requested it anyway → 404.

It only happens because the preloader runs early — before the code that moves breadcrumbs out of the first section. The normal block loader runs later, after breadcrumbs is already gone, so it never hit this.

The fix

Rather than keep a growing list of "things to skip" (breadcrumbs today, something else tomorrow), flip the logic: only preload blocks we actually recognize.

The preloader now checks each first-section element against Milo's known-block lists (C1_BLOCKS / C2_BLOCKS, plus any blocks a consumer registers via externalLibs) and skips anything not on them. breadcrumbs — and any other non-block — is quietly skipped.

This is intentionally conservative: the worst case is that we occasionally don't warm a block (harmless — it just loads normally a moment later), instead of requesting a file that isn't there (a visible 404). Commerce blocks (merch/mas) are still skipped on purpose, as before.

Resolves: MWPW-207641

Test URLs:

Consumer check (da-bacom):

Steps to test

  1. Open the Before URL, open DevTools → Network, and filter for breadcrumbs. You'll see failed (404) requests for breadcrumbs.js / breadcrumbs.css.
  2. Open the After URL and do the same. The 404s are gone, and the breadcrumbs still render normally.

🤖 Generated with Claude Code

preloadLcpCodeFiles() warms blocks/<name>/<name>.{js,css} for every first-section
div[class]:not(.content). breadcrumbs is authored there but is relocated into the
header by decorateHeader() and loaded by gnav, not from blocks/breadcrumbs/ (which
does not exist), so the preload 404s. The preload runs before decorateHeader removes
the div, unlike the real block loader. Exclude breadcrumbs, mirroring the merch/mas
exclusion.

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

aem-code-sync Bot commented Sep 15, 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

Replace the breadcrumbs denylist with an allowlist: prewarm an authored first-section
div only if its class is a known block (C1_BLOCKS/C2_BLOCKS by page foundation, plus
externalLibs blocks). Denylisting non-blocks is unbounded and 404s on a miss; the
allowlist is defensive - an unrecognized div (e.g. breadcrumbs, which gnav loads and
decorateHeader relocates) is skipped rather than fetched from a path that doesn't
exist. Commerce (merch/mas) policy exclusion retained.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vhargrave vhargrave changed the title MWPW-207641: exclude breadcrumbs from LCP preload to fix 404 MWPW-207641: prewarm only known blocks in LCP preload (fixes breadcrumbs 404) Sep 16, 2026
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vhargrave
vhargrave marked this pull request as ready for review September 16, 2026 09:03
@vhargrave
vhargrave requested review from a team, JasonHowellSlavin and hparra September 16, 2026 09:03

@hparra hparra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

image

@github-actions

Copy link
Copy Markdown
Contributor

Reminder to set the Ready for Stage label - to queue this to get merged to stage & production.

This branch was successfully deployed

1 active deployment
vhargrave/MWPW-207641-breadcrumbs-preload-404 d3742d9d Deployed Sep 16, 2026 by aem-code-sync[bot]
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.

5 participants