Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix rsc bootstrap buffer missing in the future renders (#34631)
## Bug If there's upcoming streaming data from server components, should safely skip the bootstrap process. Previously we deleted the buffer then it will cause the buffer is missing in the later re-renders. Now we mark it as empty array, so it can safely skip the boostrap phase x-ref: #34475 - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Errors have helpful link attached, see `contributing.md`
- Loading branch information
Showing
4 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
test/integration/react-streaming-and-server-components/app/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
test/integration/react-streaming-and-server-components/app/pages/streaming-rsc.server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Suspense } from 'react' | ||
|
||
let result | ||
let promise | ||
function Data() { | ||
if (result) return result | ||
if (!promise) | ||
promise = new Promise((res) => { | ||
setTimeout(() => { | ||
result = 'next_streaming_data' | ||
res() | ||
}, 500) | ||
}) | ||
throw promise | ||
} | ||
|
||
export default function Page() { | ||
return ( | ||
<Suspense fallback="next_streaming_fallback"> | ||
<Data /> | ||
</Suspense> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters