diff --git a/lib/side-effect.js b/lib/side-effect.js
index 4ca5b5af..e6c6c6f6 100644
--- a/lib/side-effect.js
+++ b/lib/side-effect.js
@@ -58,10 +58,15 @@ export default function withSideEffect (reduceComponentsToState, handleStateChan
constructor (props) {
super(props)
+ if (!SideEffect.canUseDOM) {
+ mountedInstances.add(this)
+ emitChange(this)
+ }
+ }
+ componentDidMount () {
mountedInstances.add(this)
emitChange(this)
}
-
componentDidUpdate () {
emitChange(this)
}
diff --git a/test/integration/basic/pages/dynamic/head.js b/test/integration/basic/pages/dynamic/head.js
new file mode 100644
index 00000000..59229e02
--- /dev/null
+++ b/test/integration/basic/pages/dynamic/head.js
@@ -0,0 +1,24 @@
+import dynamic from 'next/dynamic'
+import Head from 'next/head'
+
+const Test = dynamic({
+ loader: async () => {
+ // component
+ return () => {
+ return
+
+
+
+ test
+
+ }
+ },
+ ssr: false
+})
+
+export default Test
diff --git a/test/integration/basic/test/dynamic.js b/test/integration/basic/test/dynamic.js
index 9d46da67..8ce01510 100644
--- a/test/integration/basic/test/dynamic.js
+++ b/test/integration/basic/test/dynamic.js
@@ -27,6 +27,22 @@ export default (context, render) => {
}
}
})
+
+ it('should render the component Head content', async () => {
+ let browser
+ try {
+ browser = await webdriver(context.appPort, '/dynamic/head')
+ await check(() => browser.elementByCss('body').text(), /test/)
+ const backgroundColor = await browser.elementByCss('.dynamic-style').getComputedCss('background-color')
+ const height = await browser.elementByCss('.dynamic-style').getComputedCss('height')
+ expect(height).toBe('200px')
+ expect(backgroundColor).toBe('rgba(0, 128, 0, 1)')
+ } finally {
+ if (browser) {
+ browser.close()
+ }
+ }
+ })
})
describe('ssr:false option', () => {
it('Should render loading on the server side', async () => {