Skip to content

Commit

Permalink
React sync for revisions 1c2876d...7a3416f
Browse files Browse the repository at this point in the history
Reviewed By: bvaughn

Differential Revision: D7526137

fbshipit-source-id: 9f9db8a6b56cb4ae581a7b8d28079ec38de2180f
  • Loading branch information
hramos authored and facebook-github-bot committed Apr 6, 2018
1 parent 9b9b6c8 commit 445b0c7
Show file tree
Hide file tree
Showing 5 changed files with 322 additions and 292 deletions.
2 changes: 1 addition & 1 deletion Libraries/Renderer/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1c2876d5b558b8591feb335d8d7204bc46f7da8a
7a3416f27532ac25849dfbc505300d469b43bbcc
29 changes: 16 additions & 13 deletions Libraries/Renderer/ReactFabric-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -4765,6 +4765,14 @@ var ReactStrictModeWarnings = {
var didWarnAboutDeprecatedLifecycles = new Set();
var didWarnAboutUnsafeLifecycles = new Set();

var setToSortedString = function(set) {
var array = [];
set.forEach(function(value) {
array.push(value);
});
return array.sort().join(", ");
};

ReactStrictModeWarnings.discardPendingWarnings = function() {
pendingComponentWillMountWarnings = [];
pendingComponentWillReceivePropsWarnings = [];
Expand All @@ -4790,9 +4798,7 @@ var ReactStrictModeWarnings = {

var formatted = lifecycle.replace("UNSAFE_", "");
var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle];
var sortedComponentNames = Array.from(componentNames)
.sort()
.join(", ");
var sortedComponentNames = setToSortedString(componentNames);

lifecyclesWarningMesages.push(
formatted +
Expand Down Expand Up @@ -4844,9 +4850,7 @@ var ReactStrictModeWarnings = {
didWarnAboutDeprecatedLifecycles.add(fiber.type);
});

var sortedNames = Array.from(uniqueNames)
.sort()
.join(", ");
var sortedNames = setToSortedString(uniqueNames);

lowPriorityWarning$1(
false,
Expand All @@ -4869,9 +4873,7 @@ var ReactStrictModeWarnings = {
didWarnAboutDeprecatedLifecycles.add(fiber.type);
});

var _sortedNames = Array.from(_uniqueNames)
.sort()
.join(", ");
var _sortedNames = setToSortedString(_uniqueNames);

lowPriorityWarning$1(
false,
Expand All @@ -4893,9 +4895,7 @@ var ReactStrictModeWarnings = {
didWarnAboutDeprecatedLifecycles.add(fiber.type);
});

var _sortedNames2 = Array.from(_uniqueNames2)
.sort()
.join(", ");
var _sortedNames2 = setToSortedString(_uniqueNames2);

lowPriorityWarning$1(
false,
Expand Down Expand Up @@ -6217,7 +6217,6 @@ var ReactFiberClassComponent = function(
if (
typeof instance.getSnapshotBeforeUpdate === "function" &&
typeof instance.componentDidUpdate !== "function" &&
typeof instance.componentDidUpdate !== "function" &&
!didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(type)
) {
didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(type);
Expand Down Expand Up @@ -9199,6 +9198,10 @@ var ReactFiberBeginWork = function(
changedBits,
renderExpirationTime
);
} else if (oldProps === newProps) {
// Skip over a memoized parent with a bitmask bailout even
// if we began working on it because of a deeper matching child.
return bailoutOnAlreadyFinishedWork(current, workInProgress);
}
// There is no bailout on `children` equality because we expect people
// to often pass a bound method as a child, but it may reference
Expand Down
61 changes: 34 additions & 27 deletions Libraries/Renderer/ReactFabric-prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3656,33 +3656,40 @@ function ReactFiberBeginWork(
renderExpirationTime
);
case 12:
fn = workInProgress.type;
unmaskedContext = workInProgress.pendingProps;
var oldProps = workInProgress.memoizedProps;
props = fn._currentValue;
updateQueue = fn._changedBits;
if (
hasLegacyContextChanged() ||
0 !== updateQueue ||
oldProps !== unmaskedContext
) {
workInProgress.memoizedProps = unmaskedContext;
oldProps = unmaskedContext.unstable_observedBits;
if (void 0 === oldProps || null === oldProps) oldProps = 1073741823;
workInProgress.stateNode = oldProps;
0 !== (updateQueue & oldProps) &&
propagateContextChange(
workInProgress,
fn,
updateQueue,
renderExpirationTime
);
renderExpirationTime = unmaskedContext.children;
renderExpirationTime = renderExpirationTime(props);
reconcileChildren(current, workInProgress, renderExpirationTime);
current = workInProgress.child;
} else
current = bailoutOnAlreadyFinishedWork(current, workInProgress);
a: {
fn = workInProgress.type;
unmaskedContext = workInProgress.pendingProps;
updateQueue = workInProgress.memoizedProps;
props = fn._currentValue;
var changedBits = fn._changedBits;
if (
hasLegacyContextChanged() ||
0 !== changedBits ||
updateQueue !== unmaskedContext
) {
workInProgress.memoizedProps = unmaskedContext;
var observedBits = unmaskedContext.unstable_observedBits;
if (void 0 === observedBits || null === observedBits)
observedBits = 1073741823;
workInProgress.stateNode = observedBits;
if (0 !== (changedBits & observedBits))
propagateContextChange(
workInProgress,
fn,
changedBits,
renderExpirationTime
);
else if (updateQueue === unmaskedContext) {
current = bailoutOnAlreadyFinishedWork(current, workInProgress);
break a;
}
renderExpirationTime = unmaskedContext.children;
renderExpirationTime = renderExpirationTime(props);
reconcileChildren(current, workInProgress, renderExpirationTime);
current = workInProgress.child;
} else
current = bailoutOnAlreadyFinishedWork(current, workInProgress);
}
return current;
default:
invariant(
Expand Down
Loading

0 comments on commit 445b0c7

Please sign in to comment.