-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensures we don't await un-necessarily.
- Loading branch information
Showing
3 changed files
with
70 additions
and
6 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
30 changes: 30 additions & 0 deletions
30
test/production/standalone-mode/required-server-files/app/delayed/page.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,30 @@ | ||
import { Suspense } from 'react' | ||
import { cookies } from 'next/headers' | ||
|
||
export default function Page() { | ||
return ( | ||
<> | ||
<p>delayed page</p> | ||
|
||
<Suspense fallback={'loading 1...'}> | ||
<Time /> | ||
</Suspense> | ||
|
||
<Suspense fallback={'loading 2...'}> | ||
<Random /> | ||
</Suspense> | ||
</> | ||
) | ||
} | ||
|
||
async function Time() { | ||
cookies() | ||
await new Promise((resolve) => setTimeout(resolve, 1000)) | ||
return <p id="time">{Date.now()}</p> | ||
} | ||
|
||
async function Random() { | ||
cookies() | ||
await new Promise((resolve) => setTimeout(resolve, 4000)) | ||
return <p id="random">{Math.random()}</p> | ||
} |
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