-
Notifications
You must be signed in to change notification settings - Fork 26.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce dynamic IO experimental configuration
In this mode prerenders must complete in a single render Task. When PPR is off if a prerender is incomplete after a single Render Task that page is considered dynamic. When PPR is on if a prerender is incomplete after a single Render Task then all the branches that are incomplete will postpone triggering the nearest parent suspense boundary. The Dynamic APIs that bail out of prerendering will no longer trigger a postpone via a throw but will instead abort the render synchronously. This is very aggressive and to make this mode useful we intend to alter these dynamic APIs in a way that will allow their use to only exclude their local sub-tree. If you experiment with this mode expect that many of your previously static pages will become dynamic and your mostly static PPR prerenders will become empty.
- Loading branch information
Showing
70 changed files
with
3,004 additions
and
465 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
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
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
15 changes: 15 additions & 0 deletions
15
packages/next/src/server/app-render/app-render-prerender-utils.ts
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,15 @@ | ||
/** | ||
* This utility function is extracted to make it easier to find places where we are doing | ||
* specific timing tricks to try to schedule work after React has rendered. This is especially | ||
* import at the moment because Next.js uses the edge builds of React which use setTimeout to | ||
* schedule work when you might expect that something like setImmediate would do the trick. | ||
* | ||
* Long term we should switch to the node versions of React rendering when possible and then | ||
* update this to use setImmediate rather than setTimeout | ||
* | ||
* A shorter term work around would be to patch React to use setImmediate instead of setTimeout | ||
* in the edge builds since this might also avoid setTimeout throttling. | ||
*/ | ||
export async function waitAtLeastOneReactRenderTask() { | ||
return new Promise((r) => setTimeout(r, 0)) | ||
} |
Oops, something went wrong.