Socket
Socket
Sign inDemoInstall

react-dom

Package Overview
Dependencies
Maintainers
8
Versions
1940
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dom - npm Package Compare versions

Comparing version 16.0.0-alpha.2 to 16.0.0-alpha.3

lib/ReactElementType.js

2

index.js
'use strict';
module.exports = require('./lib/ReactDOM');
module.exports = require('./lib/ReactDOMFiber');

@@ -21,2 +21,3 @@ /**

var invariant = require('fbjs/lib/invariant');
var validateCallback = require('./validateCallback');

@@ -77,2 +78,3 @@ /**

for (var i = 0; i < callbacks.length; i++) {
validateCallback(callbacks[i]);
callbacks[i].call(contexts[i], arg);

@@ -79,0 +81,0 @@ }

@@ -13,87 +13,11 @@ /**

var _prodInvariant = require('./reactProdInvariant');
var checkPropTypes = require('react/lib/checkPropTypes');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var ReactPropTypesSecret = require('./ReactPropTypesSecret');
var _require = require('react/lib/ReactDebugCurrentFrame'),
getStackAddendum = _require.getStackAddendum;
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
var ReactComponentTreeHook;
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') {
// Temporary hack.
// Inline requires don't work well with Jest:
// https://github.com/facebook/react/issues/7240
// Remove the inline requires when we don't need them anymore:
// https://github.com/facebook/react/pull/7178
ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
function checkReactTypeSpec(typeSpecs, values, location, componentName) {
checkPropTypes(typeSpecs, values, location, componentName, getStackAddendum);
}
var loggedTypeFailures = {};
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?object} element The React element that is being type-checked
* @param {?number} workInProgressOrDebugID The React component instance that is being type-checked
* @private
*/
function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
// It is only safe to pass fiber if it is the work-in-progress version, and
workInProgressOrDebugID) {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
!(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0;
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var componentStackInfo = '';
if (process.env.NODE_ENV !== 'production') {
if (!ReactComponentTreeHook) {
ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
}
if (workInProgressOrDebugID != null) {
if (typeof workInProgressOrDebugID === 'number') {
// DebugID from Stack.
var debugID = workInProgressOrDebugID;
componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
} else if (typeof workInProgressOrDebugID.tag === 'number') {
// This is a Fiber.
// The stack will only be correct if this is a work in progress
// version and we're calling it during reconciliation.
var workInProgress = workInProgressOrDebugID;
componentStackInfo = ReactComponentTreeHook.getStackAddendumByWorkInProgressFiber(workInProgress);
}
} else if (element !== null) {
componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element);
}
}
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0;
}
}
}
}
module.exports = checkReactTypeSpec;

@@ -137,2 +137,10 @@ /**

} else {
if (typeof inst._currentElement === 'string') {
// Text node, let it bubble through.
return null;
}
if (!inst._rootNodeID) {
// If the instance is already unmounted, we have no listeners.
return null;
}
var _props = inst._currentElement.props;

@@ -139,0 +147,0 @@ listener = _props[registrationName];

@@ -33,5 +33,11 @@ 'use strict';

var owner = ReactCurrentOwner.current;
if (owner !== null && '_warnedAboutRefsInRender' in owner) {
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner) || 'A component') : void 0;
owner._warnedAboutRefsInRender = true;
if (owner !== null) {
var isFiber = typeof owner.tag === 'number';
var warnedAboutRefsInRender = isFiber ? owner.stateNode._warnedAboutRefsInRender : owner._warnedAboutRefsInRender;
process.env.NODE_ENV !== 'production' ? warning(warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner) || 'A component') : void 0;
if (isFiber) {
owner.stateNode._warnedAboutRefsInRender = true;
} else {
owner._warnedAboutRefsInRender = true;
}
}

@@ -38,0 +44,0 @@ }

@@ -71,40 +71,32 @@ /**

var mixedRef = element.ref;
if (mixedRef != null && typeof mixedRef !== 'function') {
if (mixedRef !== null && typeof mixedRef !== 'function') {
if (element._owner) {
var _ret = function () {
var owner = element._owner;
var inst = void 0;
if (owner) {
if (typeof owner.tag === 'number') {
var ownerFiber = owner;
!(ownerFiber.tag === ClassComponent) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0;
inst = ownerFiber.stateNode;
} else {
// Stack
inst = owner.getPublicInstance();
}
var owner = element._owner;
var inst = void 0;
if (owner) {
if (typeof owner.tag === 'number') {
var ownerFiber = owner;
!(ownerFiber.tag === ClassComponent) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0;
inst = ownerFiber.stateNode;
} else {
// Stack
inst = owner.getPublicInstance();
}
invariant(inst, 'Missing owner for string ref %s. This error is likely caused by a ' + 'bug in React. Please file an issue.', mixedRef);
var stringRef = String(mixedRef);
// Check if previous string ref matches new string ref
if (current && current.ref && current.ref._stringRef === stringRef) {
return {
v: current.ref
};
}
invariant(inst, 'Missing owner for string ref %s. This error is likely caused by a ' + 'bug in React. Please file an issue.', mixedRef);
var stringRef = String(mixedRef);
// Check if previous string ref matches new string ref
if (current !== null && current.ref !== null && current.ref._stringRef === stringRef) {
return current.ref;
}
var ref = function (value) {
var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
if (value === null) {
delete refs[stringRef];
} else {
refs[stringRef] = value;
}
var ref = function (value) {
var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
if (value === null) {
delete refs[stringRef];
} else {
refs[stringRef] = value;
}
};
ref._stringRef = stringRef;
return {
v: ref
};
}();
if (typeof _ret === "object") return _ret.v;
};
ref._stringRef = stringRef;
return ref;
}

@@ -148,3 +140,3 @@ }

// don't need to track deletion side-effects.
if (!childToDelete.alternate) {
if (childToDelete.alternate === null) {
return;

@@ -156,3 +148,3 @@ }

var last = returnFiber.progressedLastDeletion;
if (last) {
if (last !== null) {
last.nextEffect = childToDelete;

@@ -176,3 +168,3 @@ returnFiber.progressedLastDeletion = childToDelete;

var childToDelete = currentFirstChild;
while (childToDelete) {
while (childToDelete !== null) {
deleteChild(returnFiber, childToDelete);

@@ -190,3 +182,3 @@ childToDelete = childToDelete.sibling;

var existingChild = currentFirstChild;
while (existingChild) {
while (existingChild !== null) {
if (existingChild.key !== null) {

@@ -229,3 +221,3 @@ existingChildren.set(existingChild.key, existingChild);

var current = newFiber.alternate;
if (current) {
if (current !== null) {
var oldIndex = current.index;

@@ -250,3 +242,3 @@ if (oldIndex < lastPlacedIndex) {

// placement for inserting new children.
if (shouldTrackSideEffects && !newFiber.alternate) {
if (shouldTrackSideEffects && newFiber.alternate === null) {
newFiber.effectTag = Placement;

@@ -258,3 +250,3 @@ }

function updateTextNode(returnFiber, current, textContent, priority) {
if (current == null || current.tag !== HostText) {
if (current === null || current.tag !== HostText) {
// Insert

@@ -274,3 +266,3 @@ var created = createFiberFromText(textContent, priority);

function updateElement(returnFiber, current, element, priority) {
if (current == null || current.type !== element.type) {
if (current === null || current.type !== element.type) {
// Insert

@@ -297,3 +289,3 @@ var created = createFiberFromElement(element, priority);

// TODO: Should this also compare handler to determine whether to reuse?
if (current == null || current.tag !== CoroutineComponent) {
if (current === null || current.tag !== CoroutineComponent) {
// Insert

@@ -313,3 +305,3 @@ var created = createFiberFromCoroutine(coroutine, priority);

function updateYield(returnFiber, current, yieldNode, priority) {
if (current == null || current.tag !== YieldComponent) {
if (current === null || current.tag !== YieldComponent) {
// Insert

@@ -330,3 +322,3 @@ var created = createFiberFromYield(yieldNode, priority);

function updatePortal(returnFiber, current, portal, priority) {
if (current == null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) {
if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) {
// Insert

@@ -346,3 +338,3 @@ var created = createFiberFromPortal(portal, priority);

function updateFragment(returnFiber, current, fragment, priority) {
if (current == null || current.tag !== Fragment) {
if (current === null || current.tag !== Fragment) {
// Insert

@@ -419,3 +411,3 @@ var created = createFiberFromFragment(fragment, priority);

var key = oldFiber ? oldFiber.key : null;
var key = oldFiber !== null ? oldFiber.key : null;

@@ -540,3 +532,3 @@ if (typeof newChild === 'string' || typeof newChild === 'number') {

if (process.env.NODE_ENV !== 'production') {
if (typeof child !== 'object' || child == null) {
if (typeof child !== 'object' || child === null) {
return knownKeys;

@@ -552,3 +544,3 @@ }

}
if (knownKeys == null) {
if (knownKeys === null) {
knownKeys = new Set();

@@ -608,13 +600,11 @@ knownKeys.add(key);

var nextOldFiber = null;
for (; oldFiber && newIdx < newChildren.length; newIdx++) {
if (oldFiber) {
if (oldFiber.index > newIdx) {
nextOldFiber = oldFiber;
oldFiber = null;
} else {
nextOldFiber = oldFiber.sibling;
}
for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
if (oldFiber.index > newIdx) {
nextOldFiber = oldFiber;
oldFiber = null;
} else {
nextOldFiber = oldFiber.sibling;
}
var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], priority);
if (!newFiber) {
if (newFiber === null) {
// TODO: This breaks on empty slots like null children. That's

@@ -624,3 +614,3 @@ // unfortunate because it triggers the slow path all the time. We need

// boolean, undefined, etc.
if (!oldFiber) {
if (oldFiber === null) {
oldFiber = nextOldFiber;

@@ -631,3 +621,3 @@ }

if (shouldTrackSideEffects) {
if (oldFiber && !newFiber.alternate) {
if (oldFiber && newFiber.alternate === null) {
// We matched the slot, but we didn't reuse the existing fiber, so we

@@ -639,3 +629,3 @@ // need to delete the existing child.

lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
if (!previousNewFiber) {
if (previousNewFiber === null) {
// TODO: Move out of the loop. This only happens for the first run.

@@ -660,3 +650,3 @@ resultingFirstChild = newFiber;

if (!oldFiber) {
if (oldFiber === null) {
// If we don't have any more existing children we can choose a fast path

@@ -670,3 +660,3 @@ // since the rest will all be insertions.

lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
if (!previousNewFiber) {
if (previousNewFiber === null) {
// TODO: Move out of the loop. This only happens for the first run.

@@ -690,3 +680,3 @@ resultingFirstChild = _newFiber;

if (shouldTrackSideEffects) {
if (_newFiber2.alternate) {
if (_newFiber2.alternate !== null) {
// The new fiber is a work in progress, but if there exists a

@@ -700,3 +690,3 @@ // current, that means that we reused the fiber. We need to delete

lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
if (!previousNewFiber) {
if (previousNewFiber === null) {
resultingFirstChild = _newFiber2;

@@ -772,13 +762,11 @@ } else {

var step = newChildren.next();
for (; oldFiber && !step.done; newIdx++, step = newChildren.next()) {
if (oldFiber) {
if (oldFiber.index > newIdx) {
nextOldFiber = oldFiber;
oldFiber = null;
} else {
nextOldFiber = oldFiber.sibling;
}
for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
if (oldFiber.index > newIdx) {
nextOldFiber = oldFiber;
oldFiber = null;
} else {
nextOldFiber = oldFiber.sibling;
}
var newFiber = updateSlot(returnFiber, oldFiber, step.value, priority);
if (!newFiber) {
if (newFiber === null) {
// TODO: This breaks on empty slots like null children. That's

@@ -794,3 +782,3 @@ // unfortunate because it triggers the slow path all the time. We need

if (shouldTrackSideEffects) {
if (oldFiber && !newFiber.alternate) {
if (oldFiber && newFiber.alternate === null) {
// We matched the slot, but we didn't reuse the existing fiber, so we

@@ -802,3 +790,3 @@ // need to delete the existing child.

lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
if (!previousNewFiber) {
if (previousNewFiber === null) {
// TODO: Move out of the loop. This only happens for the first run.

@@ -823,3 +811,3 @@ resultingFirstChild = newFiber;

if (!oldFiber) {
if (oldFiber === null) {
// If we don't have any more existing children we can choose a fast path

@@ -829,7 +817,7 @@ // since the rest will all be insertions.

var _newFiber3 = createChild(returnFiber, step.value, priority);
if (!_newFiber3) {
if (_newFiber3 === null) {
continue;
}
lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
if (!previousNewFiber) {
if (previousNewFiber === null) {
// TODO: Move out of the loop. This only happens for the first run.

@@ -851,5 +839,5 @@ resultingFirstChild = _newFiber3;

var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, priority);
if (_newFiber4) {
if (_newFiber4 !== null) {
if (shouldTrackSideEffects) {
if (_newFiber4.alternate) {
if (_newFiber4.alternate !== null) {
// The new fiber is a work in progress, but if there exists a

@@ -863,3 +851,3 @@ // current, that means that we reused the fiber. We need to delete

lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
if (!previousNewFiber) {
if (previousNewFiber === null) {
resultingFirstChild = _newFiber4;

@@ -887,3 +875,3 @@ } else {

// way to define them.
if (currentFirstChild && currentFirstChild.tag === HostText) {
if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
// We already have an existing node so let's just update it and delete

@@ -908,3 +896,3 @@ // the rest.

var child = currentFirstChild;
while (child) {
while (child !== null) {
// TODO: If key === null and child.key === null, then this only applies to

@@ -943,3 +931,3 @@ // the first item in the list.

var child = currentFirstChild;
while (child) {
while (child !== null) {
// TODO: If key === null and child.key === null, then this only applies to

@@ -972,3 +960,3 @@ // the first item in the list.

var child = currentFirstChild;
if (child) {
if (child !== null) {
if (child.tag === YieldComponent) {

@@ -994,3 +982,3 @@ deleteRemainingChildren(returnFiber, child.sibling);

var child = currentFirstChild;
while (child) {
while (child !== null) {
// TODO: If key === null and child.key === null, then this only applies to

@@ -1148,3 +1136,3 @@ // the first item in the list.

}
if (current && workInProgress.child === current.child) {
if (current !== null && workInProgress.child === current.child) {
// We use workInProgress.child since that lets Flow know that it can't be

@@ -1165,3 +1153,3 @@ // null since we validated that already. However, as the line above suggests

newChild['return'] = workInProgress;
while (currentChild.sibling) {
while (currentChild.sibling !== null) {
currentChild = currentChild.sibling;

@@ -1179,3 +1167,3 @@ newChild = newChild.sibling = cloneFiber(currentChild, currentChild.pendingWorkPriority);

var child = workInProgress.child;
while (child) {
while (child !== null) {
child['return'] = workInProgress;

@@ -1182,0 +1170,0 @@ child = child.sibling;

@@ -29,2 +29,3 @@ /**

var checkReactTypeSpec = require('./checkReactTypeSpec');
var ReactDebugCurrentFrame = require('react/lib/ReactDebugCurrentFrame');
var warningAboutMissingGetChildContext = {};

@@ -518,3 +519,3 @@ }

if (process.env.NODE_ENV !== 'production') {
this._checkContextTypes(Component.childContextTypes, childContext, 'childContext');
this._checkContextTypes(Component.childContextTypes, childContext, 'child context');
}

@@ -548,3 +549,5 @@ for (var name in childContext) {

if (process.env.NODE_ENV !== 'production') {
checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
ReactDebugCurrentFrame.current = this._debugID;
checkReactTypeSpec(typeSpecs, values, location, this.getName());
ReactDebugCurrentFrame.current = null;
}

@@ -628,2 +631,3 @@ },

if (willReceive && inst.componentWillReceiveProps) {
var beforeState = inst.state;
if (process.env.NODE_ENV !== 'production') {

@@ -636,2 +640,10 @@ measureLifeCyclePerf(function () {

}
var afterState = inst.state;
if (beforeState !== afterState) {
inst.state = beforeState;
inst.updater.enqueueReplaceState(inst, afterState);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, '%s.componentWillReceiveProps(): Assigning directly to ' + 'this.state is deprecated (except inside a component\'s ' + 'constructor). Use setState instead.', this.getName() || 'ReactCompositeComponent') : void 0;
}
}
}

@@ -638,0 +650,0 @@

@@ -24,3 +24,3 @@ /**

var fiber = ReactDebugCurrentFiber.current;
if (fiber == null) {
if (fiber === null) {
return null;

@@ -38,3 +38,3 @@ }

var fiber = ReactDebugCurrentFiber.current;
if (fiber == null) {
if (fiber === null) {
return null;

@@ -41,0 +41,0 @@ }

@@ -26,357 +26,335 @@ /**

if (process.env.NODE_ENV !== 'production') {
var hooks;
var didHookThrowForEvent;
var isProfiling;
var flushHistory;
var lifeCycleTimerStack;
var currentFlushNesting;
var currentFlushMeasurements;
var currentFlushStartTime;
var currentTimerDebugID;
var currentTimerStartTime;
var currentTimerNestedFlushDuration;
var currentTimerType;
var lifeCycleTimerHasWarned;
var lastMarkTimeStamp;
var canUsePerformanceMeasure;
var url;
var hooks = [];
var didHookThrowForEvent = {};
(function () {
hooks = [];
didHookThrowForEvent = {};
var callHook = function (event, fn, context, arg1, arg2, arg3, arg4, arg5) {
try {
fn.call(context, arg1, arg2, arg3, arg4, arg5);
} catch (e) {
process.env.NODE_ENV !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0;
didHookThrowForEvent[event] = true;
}
};
var callHook = function (event, fn, context, arg1, arg2, arg3, arg4, arg5) {
try {
fn.call(context, arg1, arg2, arg3, arg4, arg5);
} catch (e) {
process.env.NODE_ENV !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0;
didHookThrowForEvent[event] = true;
var emitEvent = function (event, arg1, arg2, arg3, arg4, arg5) {
for (var i = 0; i < hooks.length; i++) {
var hook = hooks[i];
var fn = hook[event];
if (fn) {
callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5);
}
};
}
};
var emitEvent = function (event, arg1, arg2, arg3, arg4, arg5) {
for (var i = 0; i < hooks.length; i++) {
var hook = hooks[i];
var fn = hook[event];
if (fn) {
callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5);
}
}
};
var isProfiling = false;
var flushHistory = [];
var lifeCycleTimerStack = [];
var currentFlushNesting = 0;
var currentFlushMeasurements = [];
var currentFlushStartTime = 0;
var currentTimerDebugID = null;
var currentTimerStartTime = 0;
var currentTimerNestedFlushDuration = 0;
var currentTimerType = null;
isProfiling = false;
flushHistory = [];
lifeCycleTimerStack = [];
currentFlushNesting = 0;
currentFlushMeasurements = [];
currentFlushStartTime = 0;
currentTimerDebugID = null;
currentTimerStartTime = 0;
currentTimerNestedFlushDuration = 0;
currentTimerType = null;
lifeCycleTimerHasWarned = false;
var lifeCycleTimerHasWarned = false;
var clearHistory = function () {
ReactComponentTreeHook.purgeUnmountedComponents();
ReactHostOperationHistoryHook.clearHistory();
};
var clearHistory = function () {
ReactComponentTreeHook.purgeUnmountedComponents();
ReactHostOperationHistoryHook.clearHistory();
};
var getTreeSnapshot = function (registeredIDs) {
return registeredIDs.reduce(function (tree, id) {
var ownerID = ReactComponentTreeHook.getOwnerID(id);
var parentID = ReactComponentTreeHook.getParentID(id);
tree[id] = {
displayName: ReactComponentTreeHook.getDisplayName(id),
text: ReactComponentTreeHook.getText(id),
updateCount: ReactComponentTreeHook.getUpdateCount(id),
childIDs: ReactComponentTreeHook.getChildIDs(id),
// Text nodes don't have owners but this is close enough.
ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0,
parentID: parentID
};
return tree;
}, {});
};
var getTreeSnapshot = function (registeredIDs) {
return registeredIDs.reduce(function (tree, id) {
var ownerID = ReactComponentTreeHook.getOwnerID(id);
var parentID = ReactComponentTreeHook.getParentID(id);
tree[id] = {
displayName: ReactComponentTreeHook.getDisplayName(id),
text: ReactComponentTreeHook.getText(id),
updateCount: ReactComponentTreeHook.getUpdateCount(id),
childIDs: ReactComponentTreeHook.getChildIDs(id),
// Text nodes don't have owners but this is close enough.
ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0,
parentID: parentID
};
return tree;
}, {});
};
var resetMeasurements = function () {
var previousStartTime = currentFlushStartTime;
var previousMeasurements = currentFlushMeasurements;
var previousOperations = ReactHostOperationHistoryHook.getHistory();
var resetMeasurements = function () {
var previousStartTime = currentFlushStartTime;
var previousMeasurements = currentFlushMeasurements;
var previousOperations = ReactHostOperationHistoryHook.getHistory();
if (currentFlushNesting === 0) {
currentFlushStartTime = 0;
currentFlushMeasurements = [];
clearHistory();
return;
}
if (previousMeasurements.length || previousOperations.length) {
var registeredIDs = ReactComponentTreeHook.getRegisteredIDs();
flushHistory.push({
duration: performanceNow() - previousStartTime,
measurements: previousMeasurements || [],
operations: previousOperations || [],
treeSnapshot: getTreeSnapshot(registeredIDs)
});
}
if (currentFlushNesting === 0) {
currentFlushStartTime = 0;
currentFlushMeasurements = [];
clearHistory();
currentFlushStartTime = performanceNow();
currentFlushMeasurements = [];
};
return;
}
var checkDebugID = function (debugID) {
var allowRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (previousMeasurements.length || previousOperations.length) {
var registeredIDs = ReactComponentTreeHook.getRegisteredIDs();
flushHistory.push({
duration: performanceNow() - previousStartTime,
measurements: previousMeasurements || [],
operations: previousOperations || [],
treeSnapshot: getTreeSnapshot(registeredIDs)
});
}
if (allowRoot && debugID === 0) {
return;
}
if (!debugID) {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0;
}
};
clearHistory();
currentFlushStartTime = performanceNow();
currentFlushMeasurements = [];
};
var beginLifeCycleTimer = function (debugID, timerType) {
if (currentFlushNesting === 0) {
return;
}
if (currentTimerType && !lifeCycleTimerHasWarned) {
process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code.' + '\n\nDid not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
lifeCycleTimerHasWarned = true;
}
currentTimerStartTime = performanceNow();
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = debugID;
currentTimerType = timerType;
};
var checkDebugID = function (debugID) {
var allowRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var endLifeCycleTimer = function (debugID, timerType) {
if (currentFlushNesting === 0) {
return;
}
if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {
process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
lifeCycleTimerHasWarned = true;
}
if (isProfiling) {
currentFlushMeasurements.push({
timerType: timerType,
instanceID: debugID,
duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration
});
}
currentTimerStartTime = 0;
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = null;
currentTimerType = null;
};
if (allowRoot && debugID === 0) {
return;
}
if (!debugID) {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0;
}
};
var pauseCurrentLifeCycleTimer = function () {
var currentTimer = {
startTime: currentTimerStartTime,
nestedFlushStartTime: performanceNow(),
debugID: currentTimerDebugID,
timerType: currentTimerType
};
lifeCycleTimerStack.push(currentTimer);
currentTimerStartTime = 0;
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = null;
currentTimerType = null;
};
var beginLifeCycleTimer = function (debugID, timerType) {
if (currentFlushNesting === 0) {
return;
}
if (currentTimerType && !lifeCycleTimerHasWarned) {
process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code.' + '\n\nDid not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
lifeCycleTimerHasWarned = true;
}
currentTimerStartTime = performanceNow();
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = debugID;
currentTimerType = timerType;
};
var resumeCurrentLifeCycleTimer = function () {
var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),
startTime = _lifeCycleTimerStack$.startTime,
nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,
debugID = _lifeCycleTimerStack$.debugID,
timerType = _lifeCycleTimerStack$.timerType;
var endLifeCycleTimer = function (debugID, timerType) {
if (currentFlushNesting === 0) {
return;
}
if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {
process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
lifeCycleTimerHasWarned = true;
}
if (isProfiling) {
currentFlushMeasurements.push({
timerType: timerType,
instanceID: debugID,
duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration
});
}
currentTimerStartTime = 0;
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = null;
currentTimerType = null;
};
var nestedFlushDuration = performanceNow() - nestedFlushStartTime;
currentTimerStartTime = startTime;
currentTimerNestedFlushDuration += nestedFlushDuration;
currentTimerDebugID = debugID;
currentTimerType = timerType;
var pauseCurrentLifeCycleTimer = function () {
var currentTimer = {
startTime: currentTimerStartTime,
nestedFlushStartTime: performanceNow(),
debugID: currentTimerDebugID,
timerType: currentTimerType
};
lifeCycleTimerStack.push(currentTimer);
currentTimerStartTime = 0;
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = null;
currentTimerType = null;
};
lastMarkTimeStamp = 0;
canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
var resumeCurrentLifeCycleTimer = function () {
var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),
startTime = _lifeCycleTimerStack$.startTime,
nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,
debugID = _lifeCycleTimerStack$.debugID,
timerType = _lifeCycleTimerStack$.timerType;
var nestedFlushDuration = performanceNow() - nestedFlushStartTime;
currentTimerStartTime = startTime;
currentTimerNestedFlushDuration += nestedFlushDuration;
currentTimerDebugID = debugID;
currentTimerType = timerType;
};
var shouldMark = function (debugID) {
if (!isProfiling || !canUsePerformanceMeasure) {
return false;
}
var element = ReactComponentTreeHook.getElement(debugID);
if (element == null || typeof element !== 'object') {
return false;
}
var isHostElement = typeof element.type === 'string';
if (isHostElement) {
return false;
}
return true;
};
var lastMarkTimeStamp = 0;
var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
var markBegin = function (debugID, markType) {
if (!shouldMark(debugID)) {
return;
}
var shouldMark = function (debugID) {
if (!isProfiling || !canUsePerformanceMeasure) {
return false;
}
var element = ReactComponentTreeHook.getElement(debugID);
if (element == null || typeof element !== 'object') {
return false;
}
var isHostElement = typeof element.type === 'string';
if (isHostElement) {
return false;
}
return true;
};
var markName = debugID + '::' + markType;
lastMarkTimeStamp = performanceNow();
performance.mark(markName);
};
var markBegin = function (debugID, markType) {
if (!shouldMark(debugID)) {
return;
}
var markEnd = function (debugID, markType) {
if (!shouldMark(debugID)) {
return;
}
var markName = debugID + '::' + markType;
lastMarkTimeStamp = performanceNow();
performance.mark(markName);
};
var markName = debugID + '::' + markType;
var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';
var markEnd = function (debugID, markType) {
if (!shouldMark(debugID)) {
return;
}
// Chrome has an issue of dropping markers recorded too fast:
// https://bugs.chromium.org/p/chromium/issues/detail?id=640652
// To work around this, we will not report very small measurements.
// I determined the magic number by tweaking it back and forth.
// 0.05ms was enough to prevent the issue, but I set it to 0.1ms to be safe.
// When the bug is fixed, we can `measure()` unconditionally if we want to.
var timeStamp = performanceNow();
if (timeStamp - lastMarkTimeStamp > 0.1) {
var measurementName = displayName + ' [' + markType + ']';
performance.measure(measurementName, markName);
}
var markName = debugID + '::' + markType;
var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';
performance.clearMarks(markName);
performance.clearMeasures(measurementName);
};
// Chrome has an issue of dropping markers recorded too fast:
// https://bugs.chromium.org/p/chromium/issues/detail?id=640652
// To work around this, we will not report very small measurements.
// I determined the magic number by tweaking it back and forth.
// 0.05ms was enough to prevent the issue, but I set it to 0.1ms to be safe.
// When the bug is fixed, we can `measure()` unconditionally if we want to.
var timeStamp = performanceNow();
if (timeStamp - lastMarkTimeStamp > 0.1) {
var measurementName = displayName + ' [' + markType + ']';
performance.measure(measurementName, markName);
}
ReactDebugTool = {
addHook: function (hook) {
hooks.push(hook);
},
removeHook: function (hook) {
for (var i = 0; i < hooks.length; i++) {
if (hooks[i] === hook) {
hooks.splice(i, 1);
i--;
}
}
},
isProfiling: function () {
return isProfiling;
},
beginProfiling: function () {
if (isProfiling) {
return;
}
performance.clearMarks(markName);
performance.clearMeasures(measurementName);
};
isProfiling = true;
flushHistory.length = 0;
resetMeasurements();
ReactDebugTool.addHook(ReactHostOperationHistoryHook);
},
endProfiling: function () {
if (!isProfiling) {
return;
ReactDebugTool = {
addHook: function (hook) {
hooks.push(hook);
},
removeHook: function (hook) {
for (var i = 0; i < hooks.length; i++) {
if (hooks[i] === hook) {
hooks.splice(i, 1);
i--;
}
}
},
isProfiling: function () {
return isProfiling;
},
beginProfiling: function () {
if (isProfiling) {
return;
}
isProfiling = false;
resetMeasurements();
ReactDebugTool.removeHook(ReactHostOperationHistoryHook);
},
getFlushHistory: function () {
return flushHistory;
},
onBeginFlush: function () {
currentFlushNesting++;
resetMeasurements();
pauseCurrentLifeCycleTimer();
emitEvent('onBeginFlush');
},
onEndFlush: function () {
resetMeasurements();
currentFlushNesting--;
resumeCurrentLifeCycleTimer();
emitEvent('onEndFlush');
},
onBeginLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
emitEvent('onBeginLifeCycleTimer', debugID, timerType);
markBegin(debugID, timerType);
beginLifeCycleTimer(debugID, timerType);
},
onEndLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
endLifeCycleTimer(debugID, timerType);
markEnd(debugID, timerType);
emitEvent('onEndLifeCycleTimer', debugID, timerType);
},
onBeginProcessingChildContext: function () {
emitEvent('onBeginProcessingChildContext');
},
onEndProcessingChildContext: function () {
emitEvent('onEndProcessingChildContext');
},
onHostOperation: function (operation) {
checkDebugID(operation.instanceID);
emitEvent('onHostOperation', operation);
},
onSetState: function () {
emitEvent('onSetState');
},
onSetChildren: function (debugID, childDebugIDs) {
checkDebugID(debugID);
childDebugIDs.forEach(checkDebugID);
emitEvent('onSetChildren', debugID, childDebugIDs);
},
onBeforeMountComponent: function (debugID, element, parentDebugID) {
checkDebugID(debugID);
checkDebugID(parentDebugID, true);
emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
markBegin(debugID, 'mount');
},
onMountComponent: function (debugID) {
checkDebugID(debugID);
markEnd(debugID, 'mount');
emitEvent('onMountComponent', debugID);
},
onBeforeUpdateComponent: function (debugID, element) {
checkDebugID(debugID);
emitEvent('onBeforeUpdateComponent', debugID, element);
markBegin(debugID, 'update');
},
onUpdateComponent: function (debugID) {
checkDebugID(debugID);
markEnd(debugID, 'update');
emitEvent('onUpdateComponent', debugID);
},
onBeforeUnmountComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onBeforeUnmountComponent', debugID);
markBegin(debugID, 'unmount');
},
onUnmountComponent: function (debugID) {
checkDebugID(debugID);
markEnd(debugID, 'unmount');
emitEvent('onUnmountComponent', debugID);
},
onTestEvent: function () {
emitEvent('onTestEvent');
isProfiling = true;
flushHistory.length = 0;
resetMeasurements();
ReactDebugTool.addHook(ReactHostOperationHistoryHook);
},
endProfiling: function () {
if (!isProfiling) {
return;
}
};
ReactDebugTool.addHook(ReactInvalidSetStateWarningHook);
ReactDebugTool.addHook(ReactComponentTreeHook);
url = ExecutionEnvironment.canUseDOM && window.location.href || '';
isProfiling = false;
resetMeasurements();
ReactDebugTool.removeHook(ReactHostOperationHistoryHook);
},
getFlushHistory: function () {
return flushHistory;
},
onBeginFlush: function () {
currentFlushNesting++;
resetMeasurements();
pauseCurrentLifeCycleTimer();
emitEvent('onBeginFlush');
},
onEndFlush: function () {
resetMeasurements();
currentFlushNesting--;
resumeCurrentLifeCycleTimer();
emitEvent('onEndFlush');
},
onBeginLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
emitEvent('onBeginLifeCycleTimer', debugID, timerType);
markBegin(debugID, timerType);
beginLifeCycleTimer(debugID, timerType);
},
onEndLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
endLifeCycleTimer(debugID, timerType);
markEnd(debugID, timerType);
emitEvent('onEndLifeCycleTimer', debugID, timerType);
},
onBeginProcessingChildContext: function () {
emitEvent('onBeginProcessingChildContext');
},
onEndProcessingChildContext: function () {
emitEvent('onEndProcessingChildContext');
},
onHostOperation: function (operation) {
checkDebugID(operation.instanceID);
emitEvent('onHostOperation', operation);
},
onSetState: function () {
emitEvent('onSetState');
},
onSetChildren: function (debugID, childDebugIDs) {
checkDebugID(debugID);
childDebugIDs.forEach(checkDebugID);
emitEvent('onSetChildren', debugID, childDebugIDs);
},
onBeforeMountComponent: function (debugID, element, parentDebugID) {
checkDebugID(debugID);
checkDebugID(parentDebugID, true);
emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
markBegin(debugID, 'mount');
},
onMountComponent: function (debugID) {
checkDebugID(debugID);
markEnd(debugID, 'mount');
emitEvent('onMountComponent', debugID);
},
onBeforeUpdateComponent: function (debugID, element) {
checkDebugID(debugID);
emitEvent('onBeforeUpdateComponent', debugID, element);
markBegin(debugID, 'update');
},
onUpdateComponent: function (debugID) {
checkDebugID(debugID);
markEnd(debugID, 'update');
emitEvent('onUpdateComponent', debugID);
},
onBeforeUnmountComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onBeforeUnmountComponent', debugID);
markBegin(debugID, 'unmount');
},
onUnmountComponent: function (debugID) {
checkDebugID(debugID);
markEnd(debugID, 'unmount');
emitEvent('onUnmountComponent', debugID);
},
onTestEvent: function () {
emitEvent('onTestEvent');
}
};
if (/[?&]react_perf\b/.test(url)) {
ReactDebugTool.beginProfiling();
}
})();
ReactDebugTool.addHook(ReactInvalidSetStateWarningHook);
ReactDebugTool.addHook(ReactComponentTreeHook);
var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
if (/[?&]react_perf\b/.test(url)) {
ReactDebugTool.beginProfiling();
}
}
module.exports = ReactDebugTool;

@@ -234,2 +234,3 @@ /**

case 'img':
case 'image':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];

@@ -372,2 +373,3 @@ break;

case 'img':
case 'image':
case 'link':

@@ -473,3 +475,3 @@ case 'object':

} else {
// Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug.
// Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
// See discussion in https://github.com/facebook/react/pull/6896

@@ -942,2 +944,3 @@ // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240

case 'img':
case 'image':
case 'link':

@@ -944,0 +947,0 @@ case 'object':

@@ -245,14 +245,12 @@ /**

if (!root) {
(function () {
// First clear any existing content.
while (container.lastChild) {
container.removeChild(container.lastChild);
}
var newRoot = DOMRenderer.createContainer(container);
root = container._reactRootContainer = newRoot;
// Initial mount should not be batched.
DOMRenderer.unbatchedUpdates(function () {
DOMRenderer.updateContainer(children, newRoot, parentComponent, callback);
});
})();
// First clear any existing content.
while (container.lastChild) {
container.removeChild(container.lastChild);
}
var newRoot = DOMRenderer.createContainer(container);
root = container._reactRootContainer = newRoot;
// Initial mount should not be batched.
DOMRenderer.unbatchedUpdates(function () {
DOMRenderer.updateContainer(children, newRoot, parentComponent, callback);
});
} else {

@@ -259,0 +257,0 @@ DOMRenderer.updateContainer(children, root, parentComponent, callback);

@@ -185,2 +185,3 @@ /**

case 'img':
case 'image':
ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node);

@@ -364,3 +365,3 @@ ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node);

} else {
// Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug.
// Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
// See discussion in https://github.com/facebook/react/pull/6896

@@ -393,2 +394,3 @@ // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240

case 'img':
case 'image':
case 'link':

@@ -395,0 +397,0 @@ case 'object':

@@ -110,2 +110,5 @@ /**

fiber._debugOwner = null;
if (typeof Object.preventExtensions === 'function') {
Object.preventExtensions(fiber);
}
}

@@ -137,3 +140,3 @@

var alt = fiber.alternate;
if (alt) {
if (alt !== null) {
// If we clone, then we do so from the "current" state. The current state

@@ -140,0 +143,0 @@ // can't have any side-effects that are still valid so we reset just to be

@@ -64,3 +64,2 @@ /**

var warning = require('fbjs/lib/warning');
var warnedAboutStatelessRefs = {};

@@ -85,3 +84,3 @@ }

workInProgress.progressedPriority = priorityLevel;
if (current) {
if (current !== null) {
// We also store it on the current. When the alternate swaps in we can

@@ -113,3 +112,3 @@ // continue from this point.

workInProgress.memoizedProps = null;
if (!current) {
if (current === null) {
// If this is a fresh new component that hasn't been rendered yet, we

@@ -161,3 +160,3 @@ // won't update its child set by applying minimal side-effects. Instead,

var ref = workInProgress.ref;
if (ref && (!current || current.ref !== ref)) {
if (ref !== null && (!current || current.ref !== ref)) {
// Schedule a Ref effect

@@ -180,3 +179,3 @@ workInProgress.effectTag |= Ref;

} else {
if (nextProps == null || memoizedProps === nextProps) {
if (nextProps === null || memoizedProps === nextProps) {
return bailoutOnAlreadyFinishedWork(current, workInProgress);

@@ -216,3 +215,3 @@ }

var shouldUpdate = void 0;
if (!current) {
if (current === null) {
if (!workInProgress.stateNode) {

@@ -271,3 +270,3 @@ // In the initial pass we might need to construct the instance.

var updateQueue = workInProgress.updateQueue;
if (updateQueue) {
if (updateQueue !== null) {
var prevState = workInProgress.memoizedState;

@@ -293,3 +292,3 @@ var state = beginUpdateQueue(workInProgress, updateQueue, null, prevState, null, priorityLevel);

var nextProps = workInProgress.pendingProps;
var prevProps = current ? current.memoizedProps : null;
var prevProps = current !== null ? current.memoizedProps : null;
var memoizedProps = workInProgress.memoizedProps;

@@ -313,3 +312,3 @@ if (hasContextChanged()) {

var child = workInProgress.progressedChild;
while (child) {
while (child !== null) {
// To ensure that this subtree gets its priority reset, the children

@@ -360,5 +359,5 @@ // need to be reset.

memoizeProps(workInProgress, nextProps);
workInProgress.child = current ? current.child : null;
workInProgress.child = current !== null ? current.child : null;
if (!current) {
if (current === null) {
// If this doesn't have a current we won't track it for placement

@@ -370,3 +369,3 @@ // effects. However, when we come back around to this we have already

var _child = workInProgress.progressedChild;
while (_child) {
while (_child !== null) {
_child.effectTag = Placement;

@@ -413,3 +412,3 @@ _child = _child.sibling;

if (typeof value === 'object' && value && typeof value.render === 'function') {
if (typeof value === 'object' && value !== null && typeof value.render === 'function') {
// Proceed under the assumption that this is a class instance

@@ -429,3 +428,8 @@ workInProgress.tag = ClassComponent;

if (process.env.NODE_ENV !== 'production') {
if (workInProgress.ref != null) {
var Component = workInProgress.type;
if (Component) {
process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
}
if (workInProgress.ref !== null) {
var info = '';

@@ -461,3 +465,3 @@ var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();

nextCoroutine = current && current.memoizedProps;
invariant(nextCoroutine != null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');
invariant(nextCoroutine !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.');
}

@@ -480,3 +484,3 @@ } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) {

workInProgress.memoizedProps = null;
if (!current) {
if (current === null) {
workInProgress.stateNode = mountChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel);

@@ -516,3 +520,3 @@ } else if (current.child === workInProgress.child) {

if (!current) {
if (current === null) {
// Portals are special because we don't append the children during mount

@@ -519,0 +523,0 @@ // but at commit. Therefore we need to track insertions which the normal

@@ -41,3 +41,2 @@ /**

var shallowEqual = require('fbjs/lib/shallowEqual');
var warning = require('fbjs/lib/warning');
var invariant = require('fbjs/lib/invariant');

@@ -47,2 +46,9 @@

if (process.env.NODE_ENV !== 'production') {
var warning = require('fbjs/lib/warning');
var warnOnInvalidCallback = function (callback, callerName) {
process.env.NODE_ENV !== 'production' ? warning(callback === null || typeof callback === 'function', '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, String(callback)) : void 0;
};
}
module.exports = function (scheduleUpdate, getPriorityContext, memoizeProps, memoizeState) {

@@ -56,3 +62,7 @@

var priorityLevel = getPriorityContext();
addUpdate(fiber, partialState, callback || null, priorityLevel);
callback = callback === undefined ? null : callback;
if (process.env.NODE_ENV !== 'production') {
warnOnInvalidCallback(callback, 'setState');
}
addUpdate(fiber, partialState, callback, priorityLevel);
scheduleUpdate(fiber, priorityLevel);

@@ -63,3 +73,7 @@ },

var priorityLevel = getPriorityContext();
addReplaceUpdate(fiber, state, callback || null, priorityLevel);
callback = callback === undefined ? null : callback;
if (process.env.NODE_ENV !== 'production') {
warnOnInvalidCallback(callback, 'replaceState');
}
addReplaceUpdate(fiber, state, callback, priorityLevel);
scheduleUpdate(fiber, priorityLevel);

@@ -70,3 +84,7 @@ },

var priorityLevel = getPriorityContext();
addForceUpdate(fiber, callback || null, priorityLevel);
callback = callback === undefined ? null : callback;
if (process.env.NODE_ENV !== 'production') {
warnOnInvalidCallback(callback, 'forceUpdate');
}
addForceUpdate(fiber, callback, priorityLevel);
scheduleUpdate(fiber, priorityLevel);

@@ -77,3 +95,3 @@ }

function checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext) {
if (oldProps === null || workInProgress.updateQueue && workInProgress.updateQueue.hasForceUpdate) {
if (oldProps === null || workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate) {
// If the workInProgress already has an Update effect, return true

@@ -142,3 +160,3 @@ return true;

// effect even though we're bailing out, so that cWU/cDU are called.
if (current) {
if (current !== null) {
if (workInProgress.memoizedProps !== current.memoizedProps || workInProgress.memoizedState !== current.memoizedState) {

@@ -194,2 +212,3 @@ markUpdate(workInProgress);

instance.state = state;
instance.refs = emptyObject;
instance.context = getMaskedContext(workInProgress, unmaskedContext);

@@ -202,3 +221,3 @@

var updateQueue = workInProgress.updateQueue;
if (updateQueue) {
if (updateQueue !== null) {
instance.state = beginUpdateQueue(workInProgress, updateQueue, instance, state, props, priorityLevel);

@@ -254,3 +273,3 @@ }

var newUpdateQueue = workInProgress.updateQueue;
if (newUpdateQueue) {
if (newUpdateQueue !== null) {
newInstance.state = beginUpdateQueue(workInProgress, newUpdateQueue, newInstance, newState, newProps, priorityLevel);

@@ -285,2 +304,9 @@ }

instance.componentWillReceiveProps(newProps, newContext);
if (instance.state !== workInProgress.memoizedState) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, '%s.componentWillReceiveProps(): Assigning directly to ' + 'this.state is deprecated (except inside a component\'s ' + 'constructor). Use setState instead.', getComponentName(workInProgress)) : void 0;
}
updater.enqueueReplaceState(instance, instance.state, null);
}
}

@@ -294,3 +320,3 @@ }

var newState = void 0;
if (updateQueue) {
if (updateQueue !== null) {
newState = beginUpdateQueue(workInProgress, updateQueue, instance, oldState, newProps, priorityLevel);

@@ -301,3 +327,3 @@ } else {

if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(updateQueue && updateQueue.hasForceUpdate)) {
if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(updateQueue !== null && updateQueue.hasForceUpdate)) {
markUpdateIfAlreadyInProgress(current, workInProgress);

@@ -304,0 +330,0 @@ return false;

@@ -62,3 +62,3 @@ /**

var ref = current.ref;
if (ref) {
if (ref !== null) {
ref(null);

@@ -75,3 +75,3 @@ }

var currentRef = current.ref;
if (currentRef && currentRef !== finishedWork.ref) {
if (currentRef !== null && currentRef !== finishedWork.ref) {
currentRef(null);

@@ -84,3 +84,3 @@ }

var parent = fiber['return'];
while (parent) {
while (parent !== null) {
switch (parent.tag) {

@@ -101,3 +101,3 @@ case HostComponent:

var parent = fiber['return'];
while (parent) {
while (parent !== null) {
if (isHostParent(parent)) {

@@ -122,4 +122,4 @@ return parent;

// If we didn't find anything, let's try the next sibling.
while (!node.sibling) {
if (!node['return'] || isHostParent(node['return'])) {
while (node.sibling === null) {
if (node['return'] === null || isHostParent(node['return'])) {
// If we pop out of the root or hit the parent the fiber we are the

@@ -142,3 +142,3 @@ // last sibling.

// We also skip portals because they are not part of this host tree.
if (!node.child || node.tag === HostPortal) {
if (node.child === null || node.tag === HostPortal) {
continue siblings;

@@ -197,3 +197,3 @@ } else {

// the portal directly.
} else if (node.child) {
} else if (node.child !== null) {
node.child['return'] = node;

@@ -206,4 +206,4 @@ node = node.child;

}
while (!node.sibling) {
if (!node['return'] || node['return'] === finishedWork) {
while (node.sibling === null) {
if (node['return'] === null || node['return'] === finishedWork) {
return;

@@ -228,3 +228,3 @@ }

// Skip portals because commitUnmount() currently visits them recursively.
if (node.child && node.tag !== HostPortal) {
if (node.child !== null && node.tag !== HostPortal) {
node.child['return'] = node;

@@ -237,4 +237,4 @@ node = node.child;

}
while (!node.sibling) {
if (!node['return'] || node['return'] === root) {
while (node.sibling === null) {
if (node['return'] === null || node['return'] === root) {
return;

@@ -264,3 +264,3 @@ }

// Visit children because portals might contain host components.
if (node.child) {
if (node.child !== null) {
node.child['return'] = node;

@@ -273,3 +273,3 @@ node = node.child;

// Visit children because we may find more host components below.
if (node.child) {
if (node.child !== null) {
node.child['return'] = node;

@@ -283,4 +283,4 @@ node = node.child;

}
while (!node.sibling) {
if (!node['return'] || node['return'] === current) {
while (node.sibling === null) {
if (node['return'] === null || node['return'] === current) {
return;

@@ -369,3 +369,3 @@ }

var instance = finishedWork.stateNode;
if (instance != null && current) {
if (instance != null && current !== null) {
// Commit the work prepared earlier.

@@ -378,3 +378,3 @@ var newProps = finishedWork.memoizedProps;

finishedWork.updateQueue = null;
if (updatePayload) {
if (updatePayload !== null) {
commitUpdate(instance, updatePayload, type, oldProps, newProps, finishedWork);

@@ -388,3 +388,3 @@ }

{
invariant(finishedWork.stateNode !== null && current != null, 'This should only be done during updates. This error is likely ' + 'caused by a bug in React. Please file an issue.');
invariant(finishedWork.stateNode !== null && current !== null, 'This should only be done during updates. This error is likely ' + 'caused by a bug in React. Please file an issue.');
var textInstance = finishedWork.stateNode;

@@ -417,3 +417,3 @@ var newText = finishedWork.memoizedProps;

if (finishedWork.effectTag & Update) {
if (!current) {
if (current === null) {
if (typeof instance.componentDidMount === 'function') {

@@ -430,3 +430,3 @@ instance.componentDidMount();

}
if (finishedWork.effectTag & Callback && finishedWork.updateQueue) {
if (finishedWork.effectTag & Callback && finishedWork.updateQueue !== null) {
commitCallbacks(finishedWork, finishedWork.updateQueue, instance);

@@ -439,3 +439,3 @@ }

var updateQueue = finishedWork.updateQueue;
if (updateQueue) {
if (updateQueue !== null) {
var _instance = finishedWork.child && finishedWork.child.stateNode;

@@ -454,3 +454,3 @@ commitCallbacks(finishedWork, updateQueue, _instance);

// aka when there is no current/alternate.
if (!current && finishedWork.effectTag & Update) {
if (current === null && finishedWork.effectTag & Update) {
var type = finishedWork.type;

@@ -485,3 +485,3 @@ var props = finishedWork.memoizedProps;

var ref = finishedWork.ref;
if (ref) {
if (ref !== null) {
var instance = getPublicInstance(finishedWork.stateNode);

@@ -488,0 +488,0 @@ ref(instance);

@@ -61,3 +61,3 @@ /**

workInProgress.progressedPriority = priorityLevel;
if (current) {
if (current !== null) {
// We also store it on the current. When the alternate swaps in we can

@@ -81,3 +81,3 @@ // continue from this point.

}
while (node) {
while (node !== null) {
if (node.tag === HostComponent || node.tag === HostText || node.tag === HostPortal) {

@@ -87,3 +87,3 @@ invariant(false, 'A coroutine cannot have host component children.');

yields.push(node.type);
} else if (node.child) {
} else if (node.child !== null) {
node.child['return'] = node;

@@ -93,4 +93,4 @@ node = node.child;

}
while (!node.sibling) {
if (!node['return'] || node['return'] === workInProgress) {
while (node.sibling === null) {
if (node['return'] === null || node['return'] === workInProgress) {
return;

@@ -126,3 +126,3 @@ }

var currentFirstChild = current ? current.child : null;
var currentFirstChild = current !== null ? current.child : null;
// Inherit the priority of the returnFiber.

@@ -139,3 +139,3 @@ var priority = workInProgress.pendingWorkPriority;

var node = workInProgress.child;
while (node) {
while (node !== null) {
if (node.tag === HostComponent || node.tag === HostText) {

@@ -147,3 +147,3 @@ appendInitialChild(parent, node.stateNode);

// the portal directly.
} else if (node.child) {
} else if (node.child !== null) {
node = node.child;

@@ -155,4 +155,4 @@ continue;

}
while (!node.sibling) {
if (!node['return'] || node['return'] === workInProgress) {
while (node.sibling === null) {
if (node['return'] === null || node['return'] === workInProgress) {
return;

@@ -196,3 +196,3 @@ }

var newProps = workInProgress.memoizedProps;
if (current && workInProgress.stateNode != null) {
if (current !== null && workInProgress.stateNode != null) {
// If we have an alternate, that means this is an update and we need to

@@ -240,3 +240,3 @@ // schedule a side-effect to do the updates.

workInProgress.stateNode = _instance;
if (workInProgress.ref) {
if (workInProgress.ref !== null) {
// If there is a ref on a host node we need to schedule a callback

@@ -243,0 +243,0 @@ workInProgress.effectTag |= Ref;

@@ -38,2 +38,3 @@ /**

var checkReactTypeSpec = require('./checkReactTypeSpec');
var ReactDebugCurrentFrame = require('react/lib/ReactDebugCurrentFrame');
var warnedAboutMissingGetChildContext = {};

@@ -93,3 +94,5 @@ }

var name = getComponentName(workInProgress);
checkReactTypeSpec(contextTypes, context, 'context', name, null, workInProgress);
ReactDebugCurrentFrame.current = workInProgress;
checkReactTypeSpec(contextTypes, context, 'context', name);
ReactDebugCurrentFrame.current = null;
}

@@ -167,3 +170,5 @@

var workInProgress = isReconciling ? fiber : null;
checkReactTypeSpec(childContextTypes, childContext, 'childContext', name, null, workInProgress);
ReactDebugCurrentFrame.current = workInProgress;
checkReactTypeSpec(childContextTypes, childContext, 'child context', name);
ReactDebugCurrentFrame.current = null;
}

@@ -170,0 +175,0 @@ return _extends({}, parentContext, childContext);

@@ -14,5 +14,3 @@ /**

if (process.env.NODE_ENV !== 'production') {
var warning = require('fbjs/lib/warning');
}
var warning = require('fbjs/lib/warning');

@@ -24,41 +22,39 @@ var rendererID = null;

if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && __REACT_DEVTOOLS_GLOBAL_HOOK__.supportsFiber) {
(function () {
var inject = __REACT_DEVTOOLS_GLOBAL_HOOK__.inject,
onCommitFiberRoot = __REACT_DEVTOOLS_GLOBAL_HOOK__.onCommitFiberRoot,
onCommitFiberUnmount = __REACT_DEVTOOLS_GLOBAL_HOOK__.onCommitFiberUnmount;
var inject = __REACT_DEVTOOLS_GLOBAL_HOOK__.inject,
onCommitFiberRoot = __REACT_DEVTOOLS_GLOBAL_HOOK__.onCommitFiberRoot,
onCommitFiberUnmount = __REACT_DEVTOOLS_GLOBAL_HOOK__.onCommitFiberUnmount;
injectInternals = function (internals) {
process.env.NODE_ENV !== 'production' ? warning(rendererID == null, 'Cannot inject into DevTools twice.') : void 0;
rendererID = inject(internals);
};
injectInternals = function (internals) {
process.env.NODE_ENV !== 'production' ? warning(rendererID == null, 'Cannot inject into DevTools twice.') : void 0;
rendererID = inject(internals);
};
onCommitRoot = function (root) {
if (rendererID == null) {
return;
onCommitRoot = function (root) {
if (rendererID == null) {
return;
}
try {
onCommitFiberRoot(rendererID, root);
} catch (err) {
// Catch all errors because it is unsafe to throw in the commit phase.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'React DevTools encountered an error: %s', err) : void 0;
}
try {
onCommitFiberRoot(rendererID, root);
} catch (err) {
// Catch all errors because it is unsafe to throw in the commit phase.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'React DevTools encountered an error: %s', err) : void 0;
}
}
};
}
};
onCommitUnmount = function (fiber) {
if (rendererID == null) {
return;
onCommitUnmount = function (fiber) {
if (rendererID == null) {
return;
}
try {
onCommitFiberUnmount(rendererID, fiber);
} catch (err) {
// Catch all errors because it is unsafe to throw in the commit phase.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'React DevTools encountered an error: %s', err) : void 0;
}
try {
onCommitFiberUnmount(rendererID, fiber);
} catch (err) {
// Catch all errors because it is unsafe to throw in the commit phase.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'React DevTools encountered an error: %s', err) : void 0;
}
}
};
})();
}
};
}

@@ -65,0 +61,0 @@

@@ -36,3 +36,3 @@ /**

var rootInstance = rootInstanceStackCursor.current;
invariant(rootInstance != null, 'Expected root container to exist. This error is likely caused by a ' + 'bug in React. Please file an issue.');
invariant(rootInstance !== null, 'Expected root container to exist. This error is likely caused by a ' + 'bug in React. Please file an issue.');
return rootInstance;

@@ -70,3 +70,3 @@ }

var context = contextStackCursor.current || emptyObject;
var context = contextStackCursor.current !== null ? contextStackCursor.current : emptyObject;
var nextContext = getChildHostContext(context, fiber.type, rootInstance);

@@ -73,0 +73,0 @@

@@ -28,2 +28,3 @@ /**

if (process.env.NODE_ENV !== 'production') {
var warning = require('fbjs/lib/warning');
var ReactFiberInstrumentation = require('./ReactFiberInstrumentation');

@@ -55,3 +56,7 @@ }

var nextState = { element: element };
addTopLevelUpdate(current, nextState, callback || null, priorityLevel);
callback = callback === undefined ? null : callback;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(callback === null || typeof callback === 'function', 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', String(callback)) : void 0;
}
addTopLevelUpdate(current, nextState, callback, priorityLevel);
scheduleUpdate(current, priorityLevel);

@@ -110,3 +115,3 @@ }

var hostFiber = findCurrentHostFiber(fiber);
if (!hostFiber) {
if (hostFiber === null) {
return null;

@@ -113,0 +118,0 @@ }

@@ -77,4 +77,10 @@ /**

if (process.env.NODE_ENV !== 'production') {
var warning = require('fbjs/lib/warning');
var ReactFiberInstrumentation = require('./ReactFiberInstrumentation');
var ReactDebugCurrentFiber = require('./ReactDebugCurrentFiber');
var warnAboutUpdateOnUnmounted = function (instance) {
var ctor = instance.constructor;
process.env.NODE_ENV !== 'production' ? warning(false, 'Can only update a mounted or mounting component. This usually means ' + 'you called setState, replaceState, or forceUpdate on an unmounted ' + 'component. This is a no-op.\n\nPlease check the code for the ' + '%s component.', ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0;
};
}

@@ -185,3 +191,3 @@

// Clear out roots with no more work on them, or if they have uncaught errors
while (nextScheduledRoot && nextScheduledRoot.current.pendingWorkPriority === NoWork) {
while (nextScheduledRoot !== null && nextScheduledRoot.current.pendingWorkPriority === NoWork) {
// Unschedule this root.

@@ -208,3 +214,3 @@ nextScheduledRoot.isScheduled = false;

var highestPriorityLevel = NoWork;
while (root) {
while (root !== null) {
if (root.current.pendingWorkPriority !== NoWork && (highestPriorityLevel === NoWork || highestPriorityLevel > root.current.pendingWorkPriority)) {

@@ -217,3 +223,3 @@ highestPriorityLevel = root.current.pendingWorkPriority;

}
if (highestPriorityRoot) {
if (highestPriorityRoot !== null) {
nextPriorityLevel = highestPriorityLevel;

@@ -224,3 +230,3 @@ priorityContext = nextPriorityLevel;

// stack to work from.
// TODO: This call is burried a bit too deep. It would be nice to have
// TODO: This call is buried a bit too deep. It would be nice to have
// a single point which happens right before any new work and

@@ -238,3 +244,3 @@ // unfortunately this is it.

function commitAllHostEffects() {
while (nextEffect) {
while (nextEffect !== null) {
if (process.env.NODE_ENV !== 'production') {

@@ -301,3 +307,3 @@ ReactDebugCurrentFiber.current = nextEffect;

function commitAllLifeCycles() {
while (nextEffect) {
while (nextEffect !== null) {
var current = nextEffect.alternate;

@@ -340,2 +346,5 @@ // Use Task priority for lifecycle updates

// Reset this to null before calling lifecycles
ReactCurrentOwner.current = null;
// Updates that occur during the commit phase should have Task priority

@@ -351,3 +360,3 @@ var previousPriorityContext = priorityContext;

// it had one; that is, all the effects in the tree including the root.
if (finishedWork.lastEffect) {
if (finishedWork.lastEffect !== null) {
finishedWork.lastEffect.nextEffect = finishedWork;

@@ -369,10 +378,10 @@ firstEffect = finishedWork.firstEffect;

nextEffect = firstEffect;
while (nextEffect) {
while (nextEffect !== null) {
try {
commitAllHostEffects(finishedWork);
} catch (error) {
invariant(nextEffect != null, 'Should have next effect. This error is likely caused by a bug ' + 'in React. Please file an issue.');
invariant(nextEffect !== null, 'Should have next effect. This error is likely caused by a bug ' + 'in React. Please file an issue.');
captureError(nextEffect, error);
// Clean-up
if (nextEffect) {
if (nextEffect !== null) {
nextEffect = nextEffect.nextEffect;

@@ -396,9 +405,9 @@ }

nextEffect = firstEffect;
while (nextEffect) {
while (nextEffect !== null) {
try {
commitAllLifeCycles(finishedWork, nextEffect);
} catch (error) {
invariant(nextEffect != null, 'Should have next effect. This error is likely caused by a bug ' + 'in React. Please file an issue.');
invariant(nextEffect !== null, 'Should have next effect. This error is likely caused by a bug ' + 'in React. Please file an issue.');
captureError(nextEffect, error);
if (nextEffect) {
if (nextEffect !== null) {
nextEffect = nextEffect.nextEffect;

@@ -433,3 +442,3 @@ }

var queue = workInProgress.updateQueue;
if (queue) {
if (queue !== null) {
newPriority = getPendingPriority(queue);

@@ -444,3 +453,3 @@ }

var child = workInProgress.progressedChild;
while (child) {
while (child !== null) {
// Ensure that remaining work priority bubbles up.

@@ -469,3 +478,3 @@ if (child.pendingWorkPriority !== NoWork && (newPriority === NoWork || newPriority > child.pendingWorkPriority)) {

if (next) {
if (next !== null) {
if (process.env.NODE_ENV !== 'production' && ReactFiberInstrumentation.debugTool) {

@@ -479,11 +488,11 @@ ReactFiberInstrumentation.debugTool.onCompleteWork(workInProgress);

if (returnFiber) {
if (returnFiber !== null) {
// Append all the effects of the subtree and this fiber onto the effect
// list of the parent. The completion order of the children affects the
// side-effect order.
if (!returnFiber.firstEffect) {
if (returnFiber.firstEffect === null) {
returnFiber.firstEffect = workInProgress.firstEffect;
}
if (workInProgress.lastEffect) {
if (returnFiber.lastEffect) {
if (workInProgress.lastEffect !== null) {
if (returnFiber.lastEffect !== null) {
returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;

@@ -501,3 +510,3 @@ }

if (workInProgress.effectTag !== NoEffect) {
if (returnFiber.lastEffect) {
if (returnFiber.lastEffect !== null) {
returnFiber.lastEffect.nextEffect = workInProgress;

@@ -515,6 +524,6 @@ } else {

if (siblingFiber) {
if (siblingFiber !== null) {
// If there is more work to do in this returnFiber, do that next.
return siblingFiber;
} else if (returnFiber) {
} else if (returnFiber !== null) {
// If there's no more work in this returnFiber. Complete the returnFiber.

@@ -552,3 +561,3 @@ workInProgress = returnFiber;

if (!next) {
if (next === null) {
// If this doesn't spawn new work, complete the current work.

@@ -580,3 +589,3 @@ next = completeUnitOfWork(workInProgress);

if (!next) {
if (next === null) {
// If this doesn't spawn new work, complete the current work.

@@ -603,11 +612,11 @@ next = completeUnitOfWork(workInProgress);

isAnimationCallbackScheduled = false;
performWork(AnimationPriority);
performWork(AnimationPriority, null);
}
function clearErrors() {
if (!nextUnitOfWork) {
if (nextUnitOfWork === null) {
nextUnitOfWork = findNextUnitOfWork();
}
// Keep performing work until there are no more errors
while (capturedErrors && capturedErrors.size && nextUnitOfWork && nextPriorityLevel !== NoWork && nextPriorityLevel <= TaskPriority) {
while (capturedErrors !== null && capturedErrors.size && nextUnitOfWork !== null && nextPriorityLevel !== NoWork && nextPriorityLevel <= TaskPriority) {
if (hasCapturedError(nextUnitOfWork)) {

@@ -619,4 +628,4 @@ // Use a forked version of performUnitOfWork

}
if (!nextUnitOfWork) {
// If performUnitOfWork returns null, that means we just comitted
if (nextUnitOfWork === null) {
// If performUnitOfWork returns null, that means we just committed
// a root. Normally we'd need to clear any errors that were scheduled

@@ -634,3 +643,3 @@ // during the commit phase. But we're already clearing errors, so

if (!nextUnitOfWork) {
if (nextUnitOfWork === null) {
nextUnitOfWork = findNextUnitOfWork();

@@ -640,3 +649,3 @@ }

var hostRootTimeMarker = void 0;
if (ReactFeatureFlags.logTopLevelRenders && nextUnitOfWork && nextUnitOfWork.tag === HostRoot && nextUnitOfWork.child) {
if (ReactFeatureFlags.logTopLevelRenders && nextUnitOfWork !== null && nextUnitOfWork.tag === HostRoot && nextUnitOfWork.child !== null) {
var _componentName = getComponentName(nextUnitOfWork.child) || '';

@@ -649,6 +658,6 @@ hostRootTimeMarker = 'React update: ' + _componentName;

// using this loop that checks the deadline on every iteration.
if (deadline && priorityLevel > TaskPriority) {
if (deadline !== null && priorityLevel > TaskPriority) {
// The deferred work loop will run until there's no time left in
// the current frame.
while (nextUnitOfWork && !deadlineHasExpired) {
while (nextUnitOfWork !== null && !deadlineHasExpired) {
if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) {

@@ -660,3 +669,3 @@ nextUnitOfWork = performUnitOfWork(nextUnitOfWork);

// both to satisfy Flow.
if (!nextUnitOfWork && pendingCommit) {
if (nextUnitOfWork === null && pendingCommit !== null) {
// If we have time, we should commit the work now.

@@ -681,7 +690,7 @@ if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) {

// until we run out of work at this priority level.
while (nextUnitOfWork && nextPriorityLevel !== NoWork && nextPriorityLevel <= priorityLevel) {
while (nextUnitOfWork !== null && nextPriorityLevel !== NoWork && nextPriorityLevel <= priorityLevel) {
nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
if (!nextUnitOfWork) {
if (nextUnitOfWork === null) {
nextUnitOfWork = findNextUnitOfWork();
// performUnitOfWork returned null, which means we just comitted a
// performUnitOfWork returned null, which means we just committed a
// root. Clear any errors that were scheduled during the commit phase.

@@ -710,7 +719,7 @@ clearErrors();

while (priorityLevel !== NoWork && !fatalError) {
invariant(deadline || priorityLevel < HighPriority, 'Cannot perform deferred work without a deadline. This error is ' + 'likely caused by a bug in React. Please file an issue.');
invariant(deadline !== null || priorityLevel < HighPriority, 'Cannot perform deferred work without a deadline. This error is ' + 'likely caused by a bug in React. Please file an issue.');
// Before starting any work, check to see if there are any pending
// commits from the previous frame.
if (pendingCommit && !deadlineHasExpired) {
if (pendingCommit !== null && !deadlineHasExpired) {
commitAllWork(pendingCommit);

@@ -729,4 +738,5 @@ }

var failedWork = nextUnitOfWork;
if (failedWork) {
// Reset the priority context to its value before reconcilation.
if (failedWork !== null) {
// Reset the priority context to its value before reconciliation.
priorityContext = priorityContextBeforeReconciliation;

@@ -738,3 +748,3 @@

var maybeBoundary = captureError(failedWork, error);
if (maybeBoundary) {
if (maybeBoundary !== null) {
var boundary = maybeBoundary;

@@ -759,3 +769,3 @@

continue;
} else if (!fatalError) {
} else if (fatalError === null) {
// There is no current unit of work. This is a worst-case scenario

@@ -816,3 +826,3 @@ // and should only be possible if there's a bug in the renderer, e.g.

// It's safe to throw any unhandled errors.
if (errorToThrow) {
if (errorToThrow !== null) {
throw errorToThrow;

@@ -854,3 +864,3 @@ }

var node = failedWork['return'];
while (node && !boundary) {
while (node !== null && boundary === null) {
if (node.tag === ClassComponent) {

@@ -885,3 +895,3 @@ var instance = node.stateNode;

// a single commit without interruption.
if (commitPhaseBoundaries && (commitPhaseBoundaries.has(node) || node.alternate && commitPhaseBoundaries.has(node.alternate))) {
if (commitPhaseBoundaries !== null && (commitPhaseBoundaries.has(node) || node.alternate !== null && commitPhaseBoundaries.has(node.alternate))) {
// If so, we should ignore this error.

@@ -900,6 +910,6 @@ return null;

if (boundary) {
if (boundary !== null) {
// Add to the collection of failed boundaries. This lets us know that
// subsequent errors in this subtree should propagate to the next boundary.
if (!failedBoundaries) {
if (failedBoundaries === null) {
failedBoundaries = new Set();

@@ -920,3 +930,3 @@ }

// avoid adding a field to Fiber to store the error.
if (!capturedErrors) {
if (capturedErrors === null) {
capturedErrors = new Map();

@@ -928,2 +938,3 @@ }

error: error,
errorBoundary: errorBoundaryFound ? boundary.stateNode : null,
errorBoundaryFound: errorBoundaryFound,

@@ -937,3 +948,3 @@ errorBoundaryName: errorBoundaryName,

if (isCommitting) {
if (!commitPhaseBoundaries) {
if (commitPhaseBoundaries === null) {
commitPhaseBoundaries = new Set();

@@ -947,3 +958,3 @@ }

return boundary;
} else if (!firstUncaughtError) {
} else if (firstUncaughtError === null) {
// If no boundary is found, we'll need to throw the error

@@ -958,3 +969,3 @@ firstUncaughtError = error;

// to check the alternate.
return Boolean(capturedErrors && (capturedErrors.has(fiber) || fiber.alternate && capturedErrors.has(fiber.alternate)));
return Boolean(capturedErrors !== null && (capturedErrors.has(fiber) || fiber.alternate !== null && capturedErrors.has(fiber.alternate)));
}

@@ -965,3 +976,3 @@

// needing to check the alternate.
return Boolean(failedBoundaries && (failedBoundaries.has(fiber) || fiber.alternate && failedBoundaries.has(fiber.alternate)));
return Boolean(failedBoundaries !== null && (failedBoundaries.has(fiber) || fiber.alternate !== null && failedBoundaries.has(fiber.alternate)));
}

@@ -971,7 +982,7 @@

var capturedError = void 0;
if (capturedErrors) {
if (capturedErrors !== null) {
capturedError = capturedErrors.get(effectfulFiber);
capturedErrors['delete'](effectfulFiber);
if (!capturedError) {
if (effectfulFiber.alternate) {
if (capturedError == null) {
if (effectfulFiber.alternate !== null) {
effectfulFiber = effectfulFiber.alternate;

@@ -986,15 +997,9 @@ capturedError = capturedErrors.get(effectfulFiber);

var error = void 0;
// Conditional required to satisfy Flow
if (capturedError) {
error = capturedError.error;
try {
logCapturedError(capturedError);
} catch (e) {
// Prevent cycle if logCapturedError() throws.
// A cycle may still occur if logCapturedError renders a component that throws.
console.error(e);
}
var error = capturedError.error;
try {
logCapturedError(capturedError);
} catch (e) {
// Prevent cycle if logCapturedError() throws.
// A cycle may still occur if logCapturedError renders a component that throws.
console.error(e);
}

@@ -1010,3 +1015,3 @@

case HostRoot:
if (!firstUncaughtError) {
if (firstUncaughtError === null) {
// If this is the host container, we treat it as a no-op error

@@ -1025,3 +1030,3 @@ // boundary. We'll throw the first uncaught error once it's safe to

var node = from;
while (node && node !== to && node.alternate !== to) {
while (node !== null && node !== to && node.alternate !== to) {
switch (node.tag) {

@@ -1074,3 +1079,3 @@ case ClassComponent:

var shouldContinue = true;
while (node && shouldContinue) {
while (node !== null && shouldContinue) {
// Walk the parent path to the root and update each node's priority. Once

@@ -1085,3 +1090,3 @@ // we reach a node whose priority matches (and whose alternate's priority

}
if (node.alternate) {
if (node.alternate !== null) {
if (node.alternate.pendingWorkPriority === NoWork || node.alternate.pendingWorkPriority > priorityLevel) {

@@ -1093,3 +1098,3 @@ // Priority did not match. Update and keep going.

}
if (!node['return']) {
if (node['return'] === null) {
if (node.tag === HostRoot) {

@@ -1102,3 +1107,3 @@ var root = node.stateNode;

case SynchronousPriority:
performWork(SynchronousPriority);
performWork(SynchronousPriority, null);
return;

@@ -1119,3 +1124,7 @@ case TaskPriority:

} else {
// TODO: Warn about setting state on an unmounted component.
if (process.env.NODE_ENV !== 'production') {
if (fiber.tag === ClassComponent) {
warnAboutUpdateOnUnmounted(fiber.stateNode);
}
}
return;

@@ -1161,3 +1170,3 @@ }

if (!isPerformingWork && !isBatchingUpdates) {
performWork(TaskPriority);
performWork(TaskPriority, null);
}

@@ -1164,0 +1173,0 @@ }

@@ -17,9 +17,15 @@ /**

var ReactInstanceMap = require('./ReactInstanceMap');
var ReactCurrentOwner = require('react/lib/ReactCurrentOwner');
var invariant = require('fbjs/lib/invariant');
if (process.env.NODE_ENV !== 'production') {
var warning = require('fbjs/lib/warning');
}
var _require = require('./ReactTypeOfWork'),
HostRoot = _require.HostRoot,
HostComponent = _require.HostComponent,
HostText = _require.HostText;
HostText = _require.HostText,
ClassComponent = _require.ClassComponent;

@@ -67,2 +73,12 @@ var _require2 = require('./ReactTypeOfSideEffect'),

exports.isMounted = function (component) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null && owner.tag === ClassComponent) {
var ownerFiber = owner;
var instance = ownerFiber.stateNode;
process.env.NODE_ENV !== 'production' ? warning(instance._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber)) : void 0;
instance._warnedAboutRefsInRender = true;
}
}
var fiber = ReactInstanceMap.get(component);

@@ -226,3 +242,3 @@ if (!fiber) {

exports.getComponentName = function (fiber) {
function getComponentName(fiber) {
var type = fiber.type;

@@ -232,2 +248,3 @@ var instance = fiber.stateNode;

return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || 'A Component';
};
}
exports.getComponentName = getComponentName;

@@ -14,3 +14,4 @@ /**

var _assign = require('object-assign');
var _prodInvariant = require('./reactProdInvariant'),
_assign = require('object-assign');

@@ -25,5 +26,10 @@ var _require = require('./ReactTypeOfSideEffect'),

var validateCallback = require('./validateCallback');
var warning = require('fbjs/lib/warning');
var invariant = require('fbjs/lib/invariant');
if (process.env.NODE_ENV !== 'production') {
var warning = require('fbjs/lib/warning');
}
// Callbacks are not validated until invocation
// Singly linked-list of updates. When an update is scheduled, it is added to

@@ -183,3 +189,3 @@ // the queue of the current fiber and the work-in-progress fiber. The two queues

// each copy into a separate queue. This forks the list while maintaining a
// persistent stucture, because the update that is added to the work-in-progress
// persistent structure, because the update that is added to the work-in-progress
// is always added to the front of the list.

@@ -191,5 +197,3 @@ //

// If the update is cloned, it returns the cloned update.
function insertUpdate(fiber, update, methodName) {
validateCallback(update.callback, methodName);
function insertUpdate(fiber, update) {
var queue1 = ensureUpdateQueue(fiber);

@@ -201,7 +205,3 @@ var queue2 = fiber.alternate ? ensureUpdateQueue(fiber.alternate) : null;

if (queue1.isProcessing || queue2 && queue2.isProcessing) {
if (methodName === 'setState') {
process.env.NODE_ENV !== 'production' ? warning(false, 'setState was called from inside the updater function of another' + 'setState. A function passed as the first argument of setState ' + 'should not contain any side-effects. Return a partial state ' + 'object instead of calling setState again. Example: ' + 'this.setState(function(state) { return { count: state.count + 1 }; })') : void 0;
} else {
process.env.NODE_ENV !== 'production' ? warning(false, '%s was called from inside the updater function of setState. A ' + 'function passed as the first argument of setState ' + 'should not contain any side-effects.', methodName) : void 0;
}
process.env.NODE_ENV !== 'production' ? warning(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.') : void 0;
}

@@ -260,3 +260,3 @@ }

};
insertUpdate(fiber, update, 'setState');
insertUpdate(fiber, update);
}

@@ -275,3 +275,3 @@ exports.addUpdate = addUpdate;

};
insertUpdate(fiber, update, 'replaceState');
insertUpdate(fiber, update);
}

@@ -290,3 +290,3 @@ exports.addReplaceUpdate = addReplaceUpdate;

};
insertUpdate(fiber, update, 'forceUpdate');
insertUpdate(fiber, update);
}

@@ -312,3 +312,3 @@ exports.addForceUpdate = addForceUpdate;

};
var update2 = insertUpdate(fiber, update, 'render');
var update2 = insertUpdate(fiber, update);

@@ -387,3 +387,3 @@ if (isTopLevelUnmount) {

// last update in the queue, since a subsequent update will cause a remount.
if (update.callback && !(update.isTopLevelUnmount && update.next)) {
if (update.callback !== null && !(update.isTopLevelUnmount && update.next !== null)) {
callbackList = callbackList || [];

@@ -418,2 +418,3 @@ callbackList.push(update.callback);

var _callback = callbackList[i];
invariant(typeof _callback === 'function', 'Invalid argument passed as callback. Expected a function. Instead ' + 'received: %s', String(_callback));
_callback.call(context);

@@ -420,0 +421,0 @@ }

@@ -321,2 +321,3 @@ /**

componentInstance._pendingCallbacks = [function () {
validateCallback(callback);
callback.call(componentInstance._renderedComponent.getPublicInstance());

@@ -357,3 +358,6 @@ }];

_renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
validateCallback(callback, 'ReactDOM.render');
callback = callback === undefined ? null : callback;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(callback === null || typeof callback === 'function', 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', String(callback)) : void 0;
}
if (!React.isValidElement(nextElement)) {

@@ -385,2 +389,3 @@ if (typeof nextElement === 'string') {

var updatedCallback = callback && function () {
validateCallback(callback);
callback.call(publicInst);

@@ -387,0 +392,0 @@ };

@@ -65,3 +65,3 @@ /**

while (depth--) {
if (instA === instB) {
if (instA === instB || instA === instB.alternate) {
return instA;

@@ -80,3 +80,3 @@ }

while (instB) {
if (instB === instA) {
if (instA === instB || instA === instB.alternate) {
return true;

@@ -83,0 +83,0 @@ }

@@ -18,4 +18,8 @@ /**

var warning = require('fbjs/lib/warning');
var validateCallback = require('./validateCallback');
if (process.env.NODE_ENV !== 'production') {
var warning = require('fbjs/lib/warning');
var warnOnInvalidCallback = function (callback, callerName) {
process.env.NODE_ENV !== 'production' ? warning(callback === null || typeof callback === 'function', '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, String(callback)) : void 0;
};
}

@@ -31,6 +35,3 @@ function enqueueUpdate(internalInstance) {

var ctor = publicInstance.constructor;
// Only warn when we have a callerName. Otherwise we should be silent.
// We're probably calling from enqueueCallback. We don't want to warn
// there because we already warned for the corresponding lifecycle method.
process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0;
process.env.NODE_ENV !== 'production' ? warning(false, 'Can only update a mounted or mounting component. This usually means ' + 'you called setState, replaceState, or forceUpdate on an unmounted ' + 'component. This is a no-op.\n\nPlease check the code for the ' + '%s component.', ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0;
}

@@ -41,3 +42,3 @@ return null;

if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0;
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'Cannot update during an existing state transition (such as within ' + '`render` or another component\'s constructor). Render methods should ' + 'be a pure function of props and state; constructor side-effects are ' + 'an anti-pattern, but can be moved to `componentWillMount`.') : void 0;
}

@@ -105,3 +106,3 @@

enqueueForceUpdate: function (publicInstance, callback, callerName) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);

@@ -113,3 +114,6 @@ if (!internalInstance) {

if (callback) {
validateCallback(callback, callerName);
callback = callback === undefined ? null : callback;
if (process.env.NODE_ENV !== 'production') {
warnOnInvalidCallback(callback, callerName);
}
if (internalInstance._pendingCallbacks) {

@@ -141,3 +145,3 @@ internalInstance._pendingCallbacks.push(callback);

enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);

@@ -152,3 +156,6 @@ if (!internalInstance) {

if (callback) {
validateCallback(callback, callerName);
callback = callback === undefined ? null : callback;
if (process.env.NODE_ENV !== 'production') {
warnOnInvalidCallback(callback, callerName);
}
if (internalInstance._pendingCallbacks) {

@@ -182,3 +189,3 @@ internalInstance._pendingCallbacks.push(callback);

var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);

@@ -193,3 +200,6 @@ if (!internalInstance) {

if (callback) {
validateCallback(callback, callerName);
callback = callback === undefined ? null : callback;
if (process.env.NODE_ENV !== 'production') {
warnOnInvalidCallback(callback, callerName);
}
if (internalInstance._pendingCallbacks) {

@@ -196,0 +206,0 @@ internalInstance._pendingCallbacks.push(callback);

@@ -13,2 +13,2 @@ /**

module.exports = '16.0.0-alpha.2';
module.exports = '16.0.0-alpha.3';

@@ -18,19 +18,6 @@ /**

function formatUnexpectedArgument(arg) {
var type = typeof arg;
if (type !== 'object') {
return type;
}
var displayName = arg.constructor && arg.constructor.name || type;
var keys = Object.keys(arg);
if (keys.length > 0 && keys.length < 20) {
return displayName + ' (keys: ' + keys.join(', ') + ')';
}
return displayName;
function validateCallback(callback) {
invariant(!callback || typeof callback === 'function', 'Invalid argument passed as callback. Expected a function. Instead ' + 'received: %s', String(callback));
}
function validateCallback(callback, callerName) {
!(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0;
}
module.exports = validateCallback;
{
"name": "react-dom",
"version": "16.0.0-alpha.2",
"version": "16.0.0-alpha.3",
"description": "React package for working with the DOM.",

@@ -21,3 +21,3 @@ "main": "index.js",

"peerDependencies": {
"react": "^16.0.0-alpha.2"
"react": "^16.0.0-alpha.3"
},

@@ -24,0 +24,0 @@ "files": [

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc