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
5 changes: 5 additions & 0 deletions .changeset/rsbuild-static-chunk-availability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/start-plugin-core': patch
---

Resolve Rsbuild static chunk imports in each chunk's own loading context. A shared chunk no longer links one route's CSS and preloads into its sibling routes, and each route still links the split chunks the shared chunk uses in that route.
11 changes: 11 additions & 0 deletions e2e/react-start/deferred-hydration/src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import {
Scripts,
createRootRoute,
} from '@tanstack/react-router'
import { Hydrate } from '@tanstack/react-start'
import { never } from '@tanstack/react-start/hydration'
import rootDeferredStyles from '../shared/root-deferred.module.css'

export const Route = createRootRoute({
head: () => ({
Expand Down Expand Up @@ -173,6 +176,14 @@ function RootDocument({ children }: { children: React.ReactNode }) {
<Link to="/scroll-restoration">Scroll</Link>
</nav>
{children}
<Hydrate when={never()}>
<div
data-testid="css-root-never"
className={rootDeferredStyles.panel}
>
Root deferred CSS
</div>
</Hydrate>
<Scripts />
</body>
</html>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.panel {
color: rgb(21, 43, 65);
}
9 changes: 8 additions & 1 deletion e2e/react-start/deferred-hydration/tests/hydration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ test.describe('Hydrate CSS delivery', () => {
'production hydration coverage runs against the preview server',
)

test('ships CSS for deferred, never, shared, and nested boundaries without JavaScript', async ({
test('ships CSS for root, deferred, never, shared, and nested boundaries without JavaScript', async ({
browser,
request,
}) => {
Expand All @@ -857,6 +857,7 @@ test.describe('Hydrate CSS delivery', () => {
htmlContainsText(html, 'Deferred CSS')
htmlContainsText(html, 'Never CSS')
htmlContainsText(html, 'Nested CSS')
htmlContainsText(html, 'Root deferred CSS')

const context = await browser.newContext({ javaScriptEnabled: false })
const page = await context.newPage()
Expand All @@ -871,6 +872,12 @@ test.describe('Hydrate CSS delivery', () => {
await expect(page.getByTestId('css-never')).toHaveText('Never CSS')
await expect(page.getByTestId('css-nested')).toHaveText('Nested CSS')

await expectCssProperty(
page,
'css-root-never',
'color',
'rgb(21, 43, 65)',
)
await expectCssProperty(page, 'css-outer', 'color', 'rgb(12, 34, 56)')
await expectCssProperty(
page,
Expand Down
Loading
Loading