Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename internal property to fix React DevTools #12727

Merged
merged 1 commit into from
May 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/react-reconciler/src/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
if (updateQueue !== null) {
const nextProps = workInProgress.pendingProps;
const prevState = workInProgress.memoizedState;
const prevChildren = prevState !== null ? prevState.children : null;
const prevChildren = prevState !== null ? prevState.element : null;
processUpdateQueue(
workInProgress,
updateQueue,
Expand All @@ -426,7 +426,9 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
renderExpirationTime,
);
const nextState = workInProgress.memoizedState;
const nextChildren = nextState.children;
// Caution: React DevTools currently depends on this property
// being called "element".
const nextChildren = nextState.element;

if (nextChildren === prevChildren) {
// If the state is the same as before, that's a bailout because we had
Expand Down
4 changes: 3 additions & 1 deletion packages/react-reconciler/src/ReactFiberReconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
}

const update = createUpdate(expirationTime);
update.payload = {children: element};
// Caution: React DevTools currently depends on this property
// being called "element".
update.payload = {element};

callback = callback === undefined ? null : callback;
if (callback !== null) {
Expand Down
4 changes: 3 additions & 1 deletion packages/react-reconciler/src/ReactFiberUnwindWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export default function<C, CX>(
const update = createUpdate(expirationTime);
// Unmount the root by rendering null.
update.tag = CaptureUpdate;
update.payload = {children: null};
// Caution: React DevTools currently depends on this property
// being called "element".
update.payload = {element: null};
const error = errorInfo.value;
update.callback = () => {
onUncaughtError(error);
Expand Down