Ignore SSR mounts
Dan committed
Jun 12, 2019 at 16:15 UTC
b5850fe3044b20f00b9d5482b56989a2ad259955
1 file changed
+9
-5
src/backend/legacy/renderer.js
+9
-5
@@ -150,13 +150,17 @@ export function attach(
150
// React 15
151
oldReconcilerMethods = decorateMany(renderer.Reconciler, {
152
mountComponent(fn, args) {
153
- const [internalInstance, , , hostContainerInfo] = args;
153
+ const internalInstance = args[0];
154
+ const hostContainerInfo = args[3];
155
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
156
return fn.apply(this, args);
157
}
158
+ if (hostContainerInfo._topLevelWrapper === undefined) {
159
+ // SSR
160
+ return fn.apply(this, args);
161
+ }
162
163
const id = getID(internalInstance);
159
-
164
// Push the operation.
165
const parentID =
166
parentIDStack.length > 0
@@ -189,7 +193,7 @@ export function attach(
193
}
194
},
195
performUpdateIfNecessary(fn, args) {
192
- const [internalInstance] = args;
196
+ const internalInstance = args[0];
197
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
198
return fn.apply(this, args);
199
}
@@ -223,7 +227,7 @@ export function attach(
227
}
228
},
229
receiveComponent(fn, args) {
226
- const [internalInstance] = args;
230
+ const internalInstance = args[0];
231
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
232
return fn.apply(this, args);
233
}
@@ -257,7 +261,7 @@ export function attach(
261
}
262
},
263
unmountComponent(fn, args) {
260
- const [internalInstance] = args;
264
+ const internalInstance = args[0];
265
if (getElementType(internalInstance) === ElementTypeOtherOrUnknown) {
266
return fn.apply(this, args);
267
}