Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
revert commits
  • Loading branch information
SyMind committed May 28, 2026
commit a5166b35eba1215c970f8a9a016257bd1955d9bb
12 changes: 6 additions & 6 deletions packages/react-start-rsc/src/awaitLazyElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { ReactElement, ReactLazy, ReactSuspense } from './reactSymbols'

/**
* Optional callback for collecting CSS hrefs during tree traversal.
* Only called when processing explicitly marked RSC CSS stylesheet links.
* Only called server-side when processing <link rel="stylesheet" data-rsc-css-href>
*/
export type CssHrefCollector = (href: string) => void

/**
* Yields pending lazy element payloads from a tree, stopping at Suspense boundaries.
* Also collects CSS hrefs from explicitly marked RSC CSS stylesheet links.
* Also collects CSS hrefs from <link rel="stylesheet" data-rsc-css-href> elements.
*/
function* findPendingLazyPayloads(
obj: unknown,
Expand All @@ -26,9 +26,8 @@ function* findPendingLazyPayloads(
return
}

// Collect CSS hrefs from explicit Start-managed CSS markers. Do not collect
// ordinary React 19 stylesheet resources here: preiniting those before render
// marks them inserted and bypasses React's suspensey stylesheet commit wait.
// Collect CSS hrefs from <link rel="stylesheet" data-rsc-css-href>
// The active RSC bundler adapter injects these for CSS module imports
if (
el.$$typeof === ReactElement &&
el.type === 'link' &&
Expand Down Expand Up @@ -75,7 +74,8 @@ function* findPendingLazyPayloads(
* This ensures client component chunks are fully loaded before rendering,
* preventing Suspense boundaries from flashing during SWR navigation.
*
* Also collects CSS hrefs from explicitly marked RSC CSS stylesheet links.
* Also collects CSS hrefs from <link rel="stylesheet" data-rsc-css-href>
* elements for preloading in <head>.
*
* @param tree - The tree to process
* @param cssCollector - Optional callback to collect CSS hrefs (server-only)
Expand Down