AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

[App Router] Critical Layout CSS Lacks Preload Link Hints In Document Head

Next.js App Router does not emit `<link rel="preload" as="style">` hints before blocking stylesheets in the initial HTML, forcing the browser preload scanner to wait until the parser encounters each `<link rel="stylesheet">`, which delays FCP.

highConfidence 85%Next.jsTurbopackReact Server ComponentsAffected V16.4.0-Canary.32

Origin Analysis

The server-rendering CSS resource helper (`renderStylesheetLink`) only outputs a `<link rel="stylesheet">` tag and omits the companion preload hint. Without the preload hint, the browser's speculative parser cannot start downloading critical layout CSS early, serializing stylesheet fetches with DOM parsing and delaying render-blocking resolution.
1. Create an App Router layout with a global stylesheet import. 2. Run `next build && next start`. 3. Inspect the initial HTML `<head>` and observe only `<link rel="stylesheet">` without preceding `<link rel="preload" as="style">`.

Fixing Code Block

Edge Case Audit

The preload link may duplicate a manually injected preload for the same href; ensure deduplication if users add their own `<link rel="preload">` via `next/head` or a custom document. For cross-origin stylesheets (e.g., CDN), a `crossOrigin` attribute must be added to the preload, otherwise the preload is ignored. This change relies on React 19's `precedence` support for preload links; on older React versions the prop may be dropped or warned, so pin `react >= 19.3.0`. If regression occurs, rollback by removing the preload link and restoring the single stylesheet output, ideally behind an environment flag such as `__NEXT_EXPERIMENTAL_CSS_PRELOAD_LINKS`.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state