1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/test/integration/basic/components/nested2.js
Tim Neutkens dd9811b206
Fix recursive hydration of next/dynamic (#6326)
Fixes #5347

The main issue is that we were waiting only 1 level of dynamic imports, so the dynamic imports nested inside other dynamic import files were not awaited. This would cause either a flash of loading states or you wouldn't see the loading state (because of preload) but it would then show a hydration warning in development.

Thanks to @arthens for providing the reproduction that I modelled the tests after.
2019-02-17 19:52:00 +01:00

13 lines
216 B
JavaScript

import dynamic from 'next/dynamic'
const BrowserLoaded = dynamic(async () => () => <div>Browser hydrated</div>, {
ssr: false
})
export default () => <div>
<div>
Nested 2
</div>
<BrowserLoaded />
</div>