Skip to content

Commit

Permalink
React Native sync for revisions 424fe58...bd5bf55
Browse files Browse the repository at this point in the history
Summary:
Post: https://fb.workplace.com/groups/rnsyncsquad/permalink/879923262900946/

This sync includes the following changes:
- **[fc3b6a411](facebook/react@fc3b6a411 )**: Fix a few typos ([#22154](facebook/react#22154)) //<Bowen>//
- **[986d0e61d](facebook/react@986d0e61d )**: [Scheduler] Add tests for isInputPending ([#22140](facebook/react#22140)) //<Andrew Clark>//
- **[d54be90be](facebook/react@d54be90be )**: Set up test infra for dynamic Scheduler flags ([#22139](facebook/react#22139)) //<Andrew Clark>//
- **[7ed0706d7](facebook/react@7ed0706d7 )**: Remove the warning for setState on unmounted components ([#22114](facebook/react#22114)) //<Dan Abramov>//
- **[9eb2aaaf8](facebook/react@9eb2aaaf8 )**: Fixed ReactSharedInternals export in UMD bundle ([#22117](facebook/react#22117)) //<Brian Vaughn>//
- **[bd255700d](facebook/react@bd255700d )**: Show a soft error when a text string or number is supplied as a child to non text wrappers ([#22109](facebook/react#22109)) //<Sota>//

Changelog:
[General][Changed] - React Native sync for revisions 424fe58...bd5bf55

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D30485521

fbshipit-source-id: c5b92356e9e666eae94536ed31b8de43536419f8
  • Loading branch information
kacieb authored and facebook-github-bot committed Aug 24, 2021
1 parent bc1c533 commit 7299cb4
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 293 deletions.
2 changes: 1 addition & 1 deletion Libraries/Renderer/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
424fe587087d05302259d6d5ebb359675387f3b1
bd5bf555e1167e7088a4391e5cd419dccb39714c
176 changes: 43 additions & 133 deletions Libraries/Renderer/implementations/ReactFabric-dev.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<903768081f51a5abfed30db7d6f33dd7>>
* @generated SignedSource<<0105b67942f03415395650d296aa846a>>
*/

'use strict';
Expand Down Expand Up @@ -2939,7 +2939,7 @@ var MountPassiveDev =
4194304; // Groups of flags that are used in the commit phase to skip over trees that
// don't contain effects, by checking subtreeFlags.

var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visiblity
var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visibility
// flag logic (see #20043)
Update | Snapshot | 0;
var MutationMask =
Expand All @@ -2953,7 +2953,7 @@ var MutationMask =
var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask

var PassiveMask = Passive | ChildDeletion; // Union of tags that don't get reset on clones.
// This allows certain concepts to persist without recalculting them,
// This allows certain concepts to persist without recalculating them,
// e.g. whether a subtree contains passive effects or portals.

var StaticMask = LayoutStatic | PassiveStatic | RefStatic;
Expand Down Expand Up @@ -4988,8 +4988,10 @@ function createTextInstance(
hostContext,
internalInstanceHandle
) {
if (!hostContext.isInAParentText) {
throw Error("Text strings must be rendered within a <Text> component.");
{
if (!hostContext.isInAParentText) {
error("Text strings must be rendered within a <Text> component.");
}
}

var tag = nextReactTag;
Expand Down Expand Up @@ -5859,7 +5861,7 @@ function flushSyncCallbacksOnlyInLegacyMode() {
}
function flushSyncCallbacks() {
if (!isFlushingSyncQueue && syncQueue !== null) {
// Prevent re-entrancy.
// Prevent re-entrance.
isFlushingSyncQueue = true;
var i = 0;
var previousUpdatePriority = getCurrentUpdatePriority();
Expand Down Expand Up @@ -5898,22 +5900,7 @@ function flushSyncCallbacks() {
return null;
}

var NoFlags$1 =
/* */
0; // Represents whether effect should fire.

var HasEffect =
/* */
1; // Represents the phase in which the effect (not the clean-up) fires.

var Layout =
/* */
2;
var Passive$1 =
/* */
4;

var ReactVersion = "18.0.0-424fe5870-20210816";
var ReactVersion = "18.0.0-bd5bf555e-20210823";

var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
var NoTransition = 0;
Expand Down Expand Up @@ -6710,7 +6697,7 @@ function readContext(context) {

// An array of all update queues that received updates during the current
// render. When this render exits, either because it finishes or because it is
// interrupted, the interleaved updates will be transfered onto the main part
// interrupted, the interleaved updates will be transferred onto the main part
// of the queue.
var interleavedQueues = null;
function pushInterleavedQueue(queue) {
Expand Down Expand Up @@ -6823,7 +6810,7 @@ function enqueueUpdate(fiber, update, lane) {
if (interleaved === null) {
// This is the first update. Create a circular list.
update.next = update; // At the end of the current render, this queue's interleaved updates will
// be transfered to the pending queue.
// be transferred to the pending queue.

pushInterleavedQueue(sharedQueue);
} else {
Expand Down Expand Up @@ -9866,6 +9853,21 @@ function findFirstSuspended(row) {
return null;
}

var NoFlags$1 =
/* */
0; // Represents whether effect should fire.

var HasEffect =
/* */
1; // Represents the phase in which the effect (not the clean-up) fires.

var Layout =
/* */
2;
var Passive$1 =
/* */
4;

var isHydrating = false;

function enterHydrationState(fiber) {
Expand Down Expand Up @@ -10234,7 +10236,7 @@ function renderWithHooks(
children = Component(props, secondArg);
} while (didScheduleRenderPhaseUpdateDuringThisPass);
} // We can assume the previous dispatcher is always this one, since we set it
// at the beginning of the render phase and there's no re-entrancy.
// at the beginning of the render phase and there's no re-entrance.

ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;

Expand Down Expand Up @@ -10302,7 +10304,7 @@ function bailoutHooks(current, workInProgress, lanes) {
}
function resetHooksAfterThrow() {
// We can assume the previous dispatcher is always this one, since we set it
// at the beginning of the render phase and there's no re-entrancy.
// at the beginning of the render phase and there's no re-entrance.
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;

if (didScheduleRenderPhaseUpdate) {
Expand Down Expand Up @@ -10667,7 +10669,7 @@ function rerenderReducer(reducer, initialArg, init) {
return [newState, dispatch];
}

function readFromUnsubcribedMutableSource(root, source, getSnapshot) {
function readFromUnsubscribedMutableSource(root, source, getSnapshot) {
{
warnAboutMultipleRenderersDEV(source);
}
Expand Down Expand Up @@ -10799,7 +10801,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) {
var dispatcher = ReactCurrentDispatcher$1.current; // eslint-disable-next-line prefer-const

var _dispatcher$useState = dispatcher.useState(function() {
return readFromUnsubcribedMutableSource(root, source, getSnapshot);
return readFromUnsubscribedMutableSource(root, source, getSnapshot);
}),
currentSnapshot = _dispatcher$useState[0],
setSnapshot = _dispatcher$useState[1];
Expand Down Expand Up @@ -10928,7 +10930,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) {
);
stateHook.queue = newQueue;
stateHook.baseQueue = null;
snapshot = readFromUnsubcribedMutableSource(root, source, getSnapshot);
snapshot = readFromUnsubscribedMutableSource(root, source, getSnapshot);
stateHook.memoizedState = stateHook.baseState = snapshot;
}

Expand Down Expand Up @@ -11454,7 +11456,7 @@ function dispatchAction(fiber, queue, action) {
if (interleaved === null) {
// This is the first update. Create a circular list.
update.next = update; // At the end of the current render, this queue's interleaved updates will
// be transfered to the pending queue.
// be transferred to the pending queue.

pushInterleavedQueue(queue);
} else {
Expand Down Expand Up @@ -13835,7 +13837,7 @@ function completeWork(current, workInProgress, renderLanes) {
workInProgress.flags |= DidCapture;
cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as
// part of the second pass. In that case nothing will subscribe to
// its thennables. Instead, we'll transfer its thennables to the
// its thenables. Instead, we'll transfer its thenables to the
// SuspenseList so that it can retry if they resolve.
// There might be multiple of these in the list but since we're
// going to wait for all of them anyway, it doesn't really matter
Expand All @@ -13846,10 +13848,10 @@ function completeWork(current, workInProgress, renderLanes) {
// doesn't matter since that means that the other boundaries that
// we did find already has their listeners attached.

var newThennables = suspended.updateQueue;
var newThenables = suspended.updateQueue;

if (newThennables !== null) {
workInProgress.updateQueue = newThennables;
if (newThenables !== null) {
workInProgress.updateQueue = newThenables;
workInProgress.flags |= Update;
} // Rerender the whole list, but this time, we'll force fallbacks
// to stay in place.
Expand Down Expand Up @@ -13905,10 +13907,10 @@ function completeWork(current, workInProgress, renderLanes) {
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
// get lost if this row ends up dropped during a second pass.

var _newThennables = _suspended.updateQueue;
var _newThenables = _suspended.updateQueue;

if (_newThennables !== null) {
workInProgress.updateQueue = _newThennables;
if (_newThenables !== null) {
workInProgress.updateQueue = _newThenables;
workInProgress.flags |= Update;
}

Expand Down Expand Up @@ -15455,7 +15457,7 @@ function shouldRemainOnFallback(
var suspenseState = current.memoizedState;

if (suspenseState === null) {
// Currently showing content. Don't hide it, even if ForceSuspenseFallack
// Currently showing content. Don't hide it, even if ForceSuspenseFallback
// is true. More precise name might be "ForceRemainSuspenseFallback".
// Note: This is a factoring smell. Can't remain on a fallback if there's
// no fallback to remain on.
Expand Down Expand Up @@ -15507,7 +15509,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {

suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
pushSuspenseContext(workInProgress, suspenseContext); // OK, the next part is confusing. We're about to reconcile the Suspense
// boundary's children. This involves some custom reconcilation logic. Two
// boundary's children. This involves some custom reconciliation logic. Two
// main reasons this is so complicated.
//
// First, Legacy Mode has different semantics for backwards compatibility. The
Expand Down Expand Up @@ -18356,7 +18358,7 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
// TODO: The factoring of this phase could probably be improved. Consider
// switching on the type of work before checking the flags. That's what
// we do in all the other phases. I think this one is only different
// because of the shared reconcilation logic below.
// because of the shared reconciliation logic below.
var flags = finishedWork.flags;

if (flags & Ref) {
Expand Down Expand Up @@ -19003,10 +19005,7 @@ var nestedPassiveUpdateCount = 0; // If two updates are scheduled within the sam
// between the first and second call.

var currentEventTime = NoTimestamp;
var currentEventTransitionLane = NoLanes; // Dev only flag that tracks if passive effects are currently being flushed.
// We warn about state updates for unmounted components differently in this case.

var isFlushingPassiveEffects = false;
var currentEventTransitionLane = NoLanes;
function getWorkInProgressRoot() {
return workInProgressRoot;
}
Expand Down Expand Up @@ -19104,7 +19103,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) {
var root = markUpdateLaneFromFiberToRoot(fiber, lane);

if (root === null) {
warnAboutUpdateOnUnmountedFiberInDEV(fiber);
return null;
}

Expand Down Expand Up @@ -20429,10 +20427,6 @@ function flushPassiveEffectsImpl() {
throw Error("Cannot flush passive effects while already rendering.");
}

{
isFlushingPassiveEffects = true;
}

var prevExecutionContext = executionContext;
executionContext |= CommitContext;
commitPassiveUnmountEffects(root.current);
Expand All @@ -20448,10 +20442,6 @@ function flushPassiveEffectsImpl() {
}
}

{
isFlushingPassiveEffects = false;
}

{
commitDoubleInvokeEffectsInDEV(root.current, true);
}
Expand Down Expand Up @@ -20831,86 +20821,6 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) {
}
}

var didWarnStateUpdateForUnmountedComponent = null;

function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
{
var tag = fiber.tag;

if (
tag !== HostRoot &&
tag !== ClassComponent &&
tag !== FunctionComponent &&
tag !== ForwardRef &&
tag !== MemoComponent &&
tag !== SimpleMemoComponent
) {
// Only warn for user-defined components, not internal ones like Suspense.
return;
}

if ((fiber.flags & PassiveStatic) !== NoFlags) {
var updateQueue = fiber.updateQueue;

if (updateQueue !== null) {
var lastEffect = updateQueue.lastEffect;

if (lastEffect !== null) {
var firstEffect = lastEffect.next;
var effect = firstEffect;

do {
if (effect.destroy !== undefined) {
if ((effect.tag & Passive$1) !== NoFlags$1) {
return;
}
}

effect = effect.next;
} while (effect !== firstEffect);
}
}
} // We show the whole stack but dedupe on the top component's name because
// the problematic code almost always lies inside that component.

var componentName = getComponentNameFromFiber(fiber) || "ReactComponent";

if (didWarnStateUpdateForUnmountedComponent !== null) {
if (didWarnStateUpdateForUnmountedComponent.has(componentName)) {
return;
}

didWarnStateUpdateForUnmountedComponent.add(componentName);
} else {
didWarnStateUpdateForUnmountedComponent = new Set([componentName]);
}

if (isFlushingPassiveEffects);
else {
var previousFiber = current;

try {
setCurrentFiber(fiber);

error(
"Can't perform a React state update on an unmounted component. This " +
"is a no-op, but it indicates a memory leak in your application. To " +
"fix, cancel all subscriptions and asynchronous tasks in %s.",
tag === ClassComponent
? "the componentWillUnmount method"
: "a useEffect cleanup function"
);
} finally {
if (previousFiber) {
setCurrentFiber(fiber);
} else {
resetCurrentFiber();
}
}
}
}
}

var beginWork$1;

{
Expand Down
Loading

0 comments on commit 7299cb4

Please sign in to comment.