Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
497cbeaf
Commit
497cbeaf
authored
Aug 29, 2025
by
Tobias Koppers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: add test case for react lazy in cache components
parent
18e7c84a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
0 deletions
+95
-0
client.tsx
test/e2e/app-dir/cache-components/app/lazy/client.tsx
+5
-0
page.tsx
test/e2e/app-dir/cache-components/app/lazy/page.tsx
+20
-0
unrelated.tsx
test/e2e/app-dir/cache-components/app/lazy/unrelated.tsx
+5
-0
cache-components.lazy.test.ts
...2e/app-dir/cache-components/cache-components.lazy.test.ts
+65
-0
No files found.
test/e2e/app-dir/cache-components/app/lazy/client.tsx
0 → 100644
View file @
497cbeaf
'use client'
export
default
function
ClientComponent
()
{
return
<
p
>
Client Component
</
p
>
}
test/e2e/app-dir/cache-components/app/lazy/page.tsx
0 → 100644
View file @
497cbeaf
import
*
as
React
from
'react'
import
UnrelatedComponent
from
'./unrelated'
const
LazyClientComponent
=
React
.
lazy
(()
=>
import
(
'./client'
))
async
function
CachedComponent
()
{
'use cache'
return
(
<>
<
LazyClientComponent
/>
<
UnrelatedComponent
/>
</>
)
}
export
default
function
Page
()
{
return
<
CachedComponent
/>
}
test/e2e/app-dir/cache-components/app/lazy/unrelated.tsx
0 → 100644
View file @
497cbeaf
'use client'
export
default
function
UnrelatedComponent
()
{
return
<
section
>
Unrelated Component
</
section
>
}
test/e2e/app-dir/cache-components/cache-components.lazy.test.ts
0 → 100644
View file @
497cbeaf
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
assertNoRedbox
,
retry
}
from
'next-test-utils'
describe
(
'cache-components'
,
()
=>
{
const
{
next
,
isNextDev
}
=
nextTestSetup
({
files
:
__dirname
,
})
it
(
'should load correctly'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/lazy'
)
expect
(
await
browser
.
elementByCss
(
'p'
).
text
()).
toBe
(
'Client Component'
)
})
if
(
isNextDev
)
{
it
(
'should still work after changes'
,
async
()
=>
{
{
const
browser
=
await
next
.
browser
(
'/lazy'
)
expect
(
await
browser
.
elementByCss
(
'p'
).
text
()).
toBe
(
'Client Component'
)
expect
(
await
browser
.
elementByCss
(
'section'
).
text
()).
toBe
(
'Unrelated Component'
)
await
next
.
patchFile
(
'app/lazy/unrelated.tsx'
,
(
content
)
=>
content
.
replace
(
'Unrelated Component'
,
'Unrelated Changed Component'
),
async
()
=>
{
await
retry
(
async
()
=>
{
expect
(
await
browser
.
elementByCss
(
'section'
).
text
()).
toBe
(
'Unrelated Changed Component'
)
expect
(
await
browser
.
elementByCss
(
'p'
).
text
()).
toBe
(
'Client Component'
)
assertNoRedbox
(
browser
)
})
{
const
browser
=
await
next
.
browser
(
'/lazy'
)
expect
(
await
browser
.
elementByCss
(
'p'
).
text
()).
toBe
(
'Client Component'
)
expect
(
await
browser
.
elementByCss
(
'section'
).
text
()).
toBe
(
'Unrelated Changed Component'
)
assertNoRedbox
(
browser
)
}
}
)
}
{
const
browser
=
await
next
.
browser
(
'/lazy'
)
expect
(
await
browser
.
elementByCss
(
'p'
).
text
()).
toBe
(
'Client Component'
)
expect
(
await
browser
.
elementByCss
(
'section'
).
text
()).
toBe
(
'Unrelated Component'
)
assertNoRedbox
(
browser
)
}
})
}
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment