-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
83 additions
and
20 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
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ent-graph/dynamic-ssr-false/output.stderr → ...ver-graph/dynamic-ssr-false/output.stderr
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
5 changes: 5 additions & 0 deletions
5
test/development/app-dir/server-component-next-dynamic-ssr-false/app/client.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,5 @@ | ||
'use client' | ||
|
||
export default function Client() { | ||
return 'client' | ||
} |
7 changes: 7 additions & 0 deletions
7
test/development/app-dir/server-component-next-dynamic-ssr-false/app/layout.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,7 @@ | ||
export default function Root({ children }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
test/development/app-dir/server-component-next-dynamic-ssr-false/app/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,7 @@ | ||
import dynamic from 'next/dynamic' | ||
|
||
const DynamicClient = dynamic(() => import('./client'), { ssr: false }) | ||
|
||
export default function Page() { | ||
return <DynamicClient /> | ||
} |
36 changes: 36 additions & 0 deletions
36
...r/server-component-next-dynamic-ssr-false/server-component-next-dynamic-ssr-false.test.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,36 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
import { | ||
assertHasRedbox, | ||
getRedboxDescription, | ||
getRedboxSource, | ||
} from 'next-test-utils' | ||
|
||
describe('app-dir - server-component-next-dynamic-ssr-false', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
it('should error when use dynamic ssr:false in server component', async () => { | ||
const browser = await next.browser('/') | ||
await assertHasRedbox(browser) | ||
const redbox = { | ||
description: await getRedboxDescription(browser), | ||
source: await getRedboxSource(browser), | ||
} | ||
|
||
expect(redbox.description).toBe('Failed to compile') | ||
expect(redbox.source).toMatchInlineSnapshot(` | ||
"./app/page.js | ||
Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component. | ||
,-[3:1] | ||
1 | import dynamic from "next/dynamic" | ||
2 | | ||
3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false }) | ||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
4 | | ||
5 | export default function Page() { | ||
6 | return <DynamicClient /> | ||
\`----" | ||
`) | ||
}) | ||
}) |
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 @@ | ||
'use client' | ||
|
||
import dynamic from 'next/dynamic' | ||
|
||
const Client1 = dynamic(() => import('./client')) | ||
const Client2 = dynamic(() => import('./client-no-ssr'), { ssr: false }) | ||
|
||
export default function Page() { | ||
return ( | ||
<> | ||
<Client1 id="client-button" /> | ||
<Client2 id="client-button-no-ssr" /> | ||
</> | ||
) | ||
} |
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
10 changes: 10 additions & 0 deletions
10
test/integration/next-image-new/app-dir/app/dynamic-static-img/async-image.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,10 @@ | ||
'use client' | ||
|
||
import dynamic from 'next/dynamic' | ||
|
||
export const DynamicStaticImg = dynamic( | ||
() => import('../../components/static-img'), | ||
{ | ||
ssr: false, | ||
} | ||
) |
6 changes: 1 addition & 5 deletions
6
test/integration/next-image-new/app-dir/app/dynamic-static-img/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