Skip to content

Commit

Permalink
fix: forwarding props to no ssr dynamic (#43901)
Browse files Browse the repository at this point in the history
## Bug

Fixes: #43764

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
  • Loading branch information
huozhi committed Dec 9, 2022
1 parent 5415a0d commit d8545e6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
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

0 comments on commit d8545e6

Please sign in to comment.