Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: forwarding props to no ssr dynamic #43901

Merged
merged 2 commits into from Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/next/shared/lib/dynamic.tsx
Expand Up @@ -64,10 +64,10 @@ export function noSSR<P = {}>(
<Loading error={null} isLoading pastDelay={false} timedOut={false} />
)

return () => (
return (props: any) => (
<Suspense fallback={fallback}>
<NoSSR>
<NoSSRComponent />
<NoSSRComponent {...props} />
</NoSSR>
</Suspense>
)
Expand Down
Expand Up @@ -11,7 +11,7 @@ export function NextDynamicClientComponent() {
return (
<>
<Dynamic />
<DynamicNoSSR />
<DynamicNoSSR name=":suffix" />
</>
)
}
Expand Up @@ -3,8 +3,8 @@
import { useState } from 'react'
import styles from './dynamic.module.css'

export default function Dynamic() {
let [state] = useState('dynamic no ssr on client')
export default function Dynamic({ name }) {
let [state] = useState('dynamic no ssr on client' + name)
return (
<p id="css-text-dynamic-no-ssr-client" className={styles.dynamic}>
{`next-dynamic ${state}`}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/app-dir/index.test.ts
Expand Up @@ -171,7 +171,7 @@ describe('app dir', () => {

expect(
await browser.elementByCss('#css-text-dynamic-no-ssr-client').text()
).toBe('next-dynamic dynamic no ssr on client')
).toBe('next-dynamic dynamic no ssr on client:suffix')
})

it('should serve polyfills for browsers that do not support modules', async () => {
Expand Down