Skip to content

Commit

Permalink
Fallback to owner of returnFiber
Browse files Browse the repository at this point in the history
Won't work if the returnFiber is a fragment. Not sure it matters;
warning will just be less descriptive.
  • Loading branch information
acdlite committed Jan 31, 2017
1 parent 3089db9 commit 802c820
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/renderers/shared/fiber/ReactChildFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function coerceRef(current: ?Fiber, element: ReactElement) {
return mixedRef;
}

function throwOnInvalidObjectType(newChild : Object) {
function throwOnInvalidObjectType(returnFiber : Fiber, newChild : Object) {
const childrenString = String(newChild);
let addendum = '';
if (__DEV__) {
Expand All @@ -122,9 +122,9 @@ function throwOnInvalidObjectType(newChild : Object) {
' It looks like you\'re using an element created by a different ' +
'version of React. Make sure to use only one copy of React.';
}
if (ReactCurrentOwner.current) {
const owner : Fiber = (ReactCurrentOwner.current : any);
let name = getComponentName(owner);
const owner = ReactCurrentOwner.owner || returnFiber._debugOwner;
if (owner && typeof owner.tag === 'number') {
const name = getComponentName((owner : any));
if (name) {
addendum += ' Check the render method of `' + name + '`.';
}
Expand Down Expand Up @@ -452,7 +452,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
return created;
}

throwOnInvalidObjectType(newChild);
throwOnInvalidObjectType(returnFiber, newChild);
}

return null;
Expand Down Expand Up @@ -517,7 +517,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
return updateFragment(returnFiber, oldFiber, newChild, priority);
}

throwOnInvalidObjectType(newChild);
throwOnInvalidObjectType(returnFiber, newChild);
}

return null;
Expand Down Expand Up @@ -574,7 +574,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
return updateFragment(returnFiber, matchedFiber, newChild, priority);
}

throwOnInvalidObjectType(newChild);
throwOnInvalidObjectType(returnFiber, newChild);
}

return null;
Expand Down Expand Up @@ -1240,7 +1240,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
}

if (isObject) {
throwOnInvalidObjectType(newChild);
throwOnInvalidObjectType(returnFiber, newChild);
}

if (!disableNewFiberFeatures && typeof newChild === 'undefined') {
Expand Down

0 comments on commit 802c820

Please sign in to comment.