Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable pure client suspense in blocking rendering (#28165)
Do not fallback to loadable component when `reactRoot` is enabled but without `concurrentFeatures`. Thus we can enable pure client suspense: `fallback` is always rendered on server side, but client side can work with fully functional suspense. Closes #28117
- Loading branch information
Showing
4 changed files
with
45 additions
and
28 deletions.
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
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 |
---|---|---|
@@ -1,10 +1,19 @@ | ||
import React from 'react' | ||
import React, { Suspense } from 'react' | ||
import dynamic from 'next/dynamic' | ||
|
||
// flag for testing | ||
const wrapped = true | ||
|
||
const Hello = dynamic(() => import('../../components/hello'), { | ||
suspense: true, | ||
}) | ||
|
||
export default function Unwrapped() { | ||
return <Hello /> | ||
if (!wrapped) return <Hello /> | ||
|
||
return ( | ||
<Suspense fallback={`loading`}> | ||
<Hello /> | ||
</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
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