-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "if there are errors during postpone, or postpone was caught, …
- Loading branch information
Showing
12 changed files
with
203 additions
and
114 deletions.
There are no files selected for viewing
File renamed without changes.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
34 changes: 34 additions & 0 deletions
34
test/e2e/app-dir/ppr/app/suspense/node/cookies-error/page.jsx
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,34 @@ | ||
import React, { Suspense } from 'react' | ||
import { cookies } from 'next/headers' | ||
|
||
import { Dynamic } from '../../../../components/dynamic' | ||
|
||
export default async function Page() { | ||
return ( | ||
<> | ||
<h2>Dynamic Component Catching Errors</h2> | ||
<p> | ||
This shows the dynamic component that reads cookies but wraps the read | ||
in a try/catch. This test re-throws the error that is caught. | ||
</p> | ||
<div id="container"> | ||
<Suspense fallback={<Dynamic fallback />}> | ||
<Dynamic catchErrors /> | ||
</Suspense> | ||
|
||
<Suspense fallback={<div>Loading...</div>}> | ||
<Foobar /> | ||
</Suspense> | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
async function Foobar() { | ||
try { | ||
cookies() | ||
} catch (err) { | ||
throw new Error('You are not signed in') | ||
} | ||
return null | ||
} |
33 changes: 33 additions & 0 deletions
33
test/e2e/app-dir/ppr/app/suspense/node/fetch-error/page.jsx
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,33 @@ | ||
import React, { Suspense } from 'react' | ||
|
||
import { Dynamic } from '../../../../components/dynamic' | ||
|
||
export default async function Page() { | ||
const getData = () => | ||
fetch('https://example.vercel.sh', { | ||
cache: 'no-store', | ||
}) | ||
.then((res) => res.text()) | ||
.then((text) => new Promise((res) => setTimeout(() => res(text), 1000))) | ||
|
||
try { | ||
await getData() | ||
} catch (err) { | ||
throw new Error('Fetch failed') | ||
} | ||
|
||
return ( | ||
<> | ||
<h2>Dynamic Component Catching Errors</h2> | ||
<p> | ||
This shows the dynamic component that reads cookies but wraps the read | ||
in a try/catch. | ||
</p> | ||
<div id="container"> | ||
<Suspense fallback={<Dynamic fallback />}> | ||
<Dynamic catchErrors /> | ||
</Suspense> | ||
</div> | ||
</> | ||
) | ||
} |
Oops, something went wrong.