Rename internal property to fix React DevTools (#12727)
Dan Abramov committed
May 1, 2018 at 21:04 UTC
ad7cd686670d8e519789fb226d8ff9175fb69370
3 files changed
+10
-4
packages/react-reconciler/src/ReactFiberBeginWork.js
+4
-2
@@ -417,7 +417,7 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
417
if (updateQueue !== null) {
418
const nextProps = workInProgress.pendingProps;
419
const prevState = workInProgress.memoizedState;
420
- const prevChildren = prevState !== null ? prevState.children : null;
420
+ const prevChildren = prevState !== null ? prevState.element : null;
421
processUpdateQueue(
422
workInProgress,
423
updateQueue,
@@ -426,7 +426,9 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
426
renderExpirationTime,
427
);
428
const nextState = workInProgress.memoizedState;
429
- const nextChildren = nextState.children;
429
+ // Caution: React DevTools currently depends on this property
430
+ // being called "element".
431
+ const nextChildren = nextState.element;
432
433
if (nextChildren === prevChildren) {
434
// If the state is the same as before, that's a bailout because we had
packages/react-reconciler/src/ReactFiberReconciler.js
+3
-1
@@ -340,7 +340,9 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
340
}
341
342
const update = createUpdate(expirationTime);
343
- update.payload = {children: element};
343
+ // Caution: React DevTools currently depends on this property
344
+ // being called "element".
345
+ update.payload = {element};
346
347
callback = callback === undefined ? null : callback;
348
if (callback !== null) {
packages/react-reconciler/src/ReactFiberUnwindWork.js
+3
-1
@@ -67,7 +67,9 @@ export default function<C, CX>(
67
const update = createUpdate(expirationTime);
68
// Unmount the root by rendering null.
69
update.tag = CaptureUpdate;
70
- update.payload = {children: null};
70
+ // Caution: React DevTools currently depends on this property
71
+ // being called "element".
72
+ update.payload = {element: null};
73
const error = errorInfo.value;
74
update.callback = () => {
75
onUncaughtError(error);