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
d4d79b2d
Unverified
Commit
d4d79b2d
authored
Feb 17, 2022
by
Shu Ding
Committed by
GitHub
Feb 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix chunk buffering for server components (#34474)
parent
74fa4d4b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
render.tsx
packages/next/server/render.tsx
+20
-11
No files found.
packages/next/server/render.tsx
View file @
d4d79b2d
...
...
@@ -1764,19 +1764,28 @@ function createInlineDataStream(
if
(
!
dataStreamFinished
&&
dataStream
)
{
const
dataStreamReader
=
dataStream
.
getReader
()
dataStreamFinished
=
(
async
()
=>
{
try
{
while
(
true
)
{
const
{
done
,
value
}
=
await
dataStreamReader
.
read
()
if
(
done
)
{
return
// We are buffering here for the inlined data stream because the
// "shell" stream might be chunkenized again by the underlying stream
// implementation, e.g. with a specific high-water mark. To ensure it's
// the safe timing to pipe the data stream, this extra tick is
// necessary.
dataStreamFinished
=
new
Promise
((
res
)
=>
setTimeout
(
async
()
=>
{
try
{
while
(
true
)
{
const
{
done
,
value
}
=
await
dataStreamReader
.
read
()
if
(
done
)
{
return
res
()
}
controller
.
enqueue
(
value
)
}
controller
.
enqueue
(
value
)
}
catch
(
err
)
{
controller
.
error
(
err
)
}
}
catch
(
err
)
{
controller
.
error
(
err
)
}
})()
res
()
},
0
)
)
}
},
flush
()
{
...
...
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