Skip to content

Commit 7299cb4

Browse files
kaciebfacebook-github-bot
authored andcommitted
React Native sync for revisions 424fe58...bd5bf55
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
1 parent bc1c533 commit 7299cb4

7 files changed

+107
-293
lines changed

Libraries/Renderer/REVISION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
424fe587087d05302259d6d5ebb359675387f3b1
1+
bd5bf555e1167e7088a4391e5cd419dccb39714c

Libraries/Renderer/implementations/ReactFabric-dev.fb.js

+43-133
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<903768081f51a5abfed30db7d6f33dd7>>
10+
* @generated SignedSource<<0105b67942f03415395650d296aa846a>>
1111
*/
1212

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

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

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

29592959
var StaticMask = LayoutStatic | PassiveStatic | RefStatic;
@@ -4988,8 +4988,10 @@ function createTextInstance(
49884988
hostContext,
49894989
internalInstanceHandle
49904990
) {
4991-
if (!hostContext.isInAParentText) {
4992-
throw Error("Text strings must be rendered within a <Text> component.");
4991+
{
4992+
if (!hostContext.isInAParentText) {
4993+
error("Text strings must be rendered within a <Text> component.");
4994+
}
49934995
}
49944996

49954997
var tag = nextReactTag;
@@ -5859,7 +5861,7 @@ function flushSyncCallbacksOnlyInLegacyMode() {
58595861
}
58605862
function flushSyncCallbacks() {
58615863
if (!isFlushingSyncQueue && syncQueue !== null) {
5862-
// Prevent re-entrancy.
5864+
// Prevent re-entrance.
58635865
isFlushingSyncQueue = true;
58645866
var i = 0;
58655867
var previousUpdatePriority = getCurrentUpdatePriority();
@@ -5898,22 +5900,7 @@ function flushSyncCallbacks() {
58985900
return null;
58995901
}
59005902

5901-
var NoFlags$1 =
5902-
/* */
5903-
0; // Represents whether effect should fire.
5904-
5905-
var HasEffect =
5906-
/* */
5907-
1; // Represents the phase in which the effect (not the clean-up) fires.
5908-
5909-
var Layout =
5910-
/* */
5911-
2;
5912-
var Passive$1 =
5913-
/* */
5914-
4;
5915-
5916-
var ReactVersion = "18.0.0-424fe5870-20210816";
5903+
var ReactVersion = "18.0.0-bd5bf555e-20210823";
59175904

59185905
var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
59195906
var NoTransition = 0;
@@ -6710,7 +6697,7 @@ function readContext(context) {
67106697

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

68286815
pushInterleavedQueue(sharedQueue);
68296816
} else {
@@ -9866,6 +9853,21 @@ function findFirstSuspended(row) {
98669853
return null;
98679854
}
98689855

9856+
var NoFlags$1 =
9857+
/* */
9858+
0; // Represents whether effect should fire.
9859+
9860+
var HasEffect =
9861+
/* */
9862+
1; // Represents the phase in which the effect (not the clean-up) fires.
9863+
9864+
var Layout =
9865+
/* */
9866+
2;
9867+
var Passive$1 =
9868+
/* */
9869+
4;
9870+
98699871
var isHydrating = false;
98709872

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

1023910241
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
1024010242

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

1030810310
if (didScheduleRenderPhaseUpdate) {
@@ -10667,7 +10669,7 @@ function rerenderReducer(reducer, initialArg, init) {
1066710669
return [newState, dispatch];
1066810670
}
1066910671

10670-
function readFromUnsubcribedMutableSource(root, source, getSnapshot) {
10672+
function readFromUnsubscribedMutableSource(root, source, getSnapshot) {
1067110673
{
1067210674
warnAboutMultipleRenderersDEV(source);
1067310675
}
@@ -10799,7 +10801,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) {
1079910801
var dispatcher = ReactCurrentDispatcher$1.current; // eslint-disable-next-line prefer-const
1080010802

1080110803
var _dispatcher$useState = dispatcher.useState(function() {
10802-
return readFromUnsubcribedMutableSource(root, source, getSnapshot);
10804+
return readFromUnsubscribedMutableSource(root, source, getSnapshot);
1080310805
}),
1080410806
currentSnapshot = _dispatcher$useState[0],
1080510807
setSnapshot = _dispatcher$useState[1];
@@ -10928,7 +10930,7 @@ function useMutableSource(hook, source, getSnapshot, subscribe) {
1092810930
);
1092910931
stateHook.queue = newQueue;
1093010932
stateHook.baseQueue = null;
10931-
snapshot = readFromUnsubcribedMutableSource(root, source, getSnapshot);
10933+
snapshot = readFromUnsubscribedMutableSource(root, source, getSnapshot);
1093210934
stateHook.memoizedState = stateHook.baseState = snapshot;
1093310935
}
1093410936

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

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

13849-
var newThennables = suspended.updateQueue;
13851+
var newThenables = suspended.updateQueue;
1385013852

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

13908-
var _newThennables = _suspended.updateQueue;
13910+
var _newThenables = _suspended.updateQueue;
1390913911

13910-
if (_newThennables !== null) {
13911-
workInProgress.updateQueue = _newThennables;
13912+
if (_newThenables !== null) {
13913+
workInProgress.updateQueue = _newThenables;
1391213914
workInProgress.flags |= Update;
1391313915
}
1391413916

@@ -15455,7 +15457,7 @@ function shouldRemainOnFallback(
1545515457
var suspenseState = current.memoizedState;
1545615458

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

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

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

1900519007
var currentEventTime = NoTimestamp;
19006-
var currentEventTransitionLane = NoLanes; // Dev only flag that tracks if passive effects are currently being flushed.
19007-
// We warn about state updates for unmounted components differently in this case.
19008-
19009-
var isFlushingPassiveEffects = false;
19008+
var currentEventTransitionLane = NoLanes;
1901019009
function getWorkInProgressRoot() {
1901119010
return workInProgressRoot;
1901219011
}
@@ -19104,7 +19103,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) {
1910419103
var root = markUpdateLaneFromFiberToRoot(fiber, lane);
1910519104

1910619105
if (root === null) {
19107-
warnAboutUpdateOnUnmountedFiberInDEV(fiber);
1910819106
return null;
1910919107
}
1911019108

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

20432-
{
20433-
isFlushingPassiveEffects = true;
20434-
}
20435-
2043620430
var prevExecutionContext = executionContext;
2043720431
executionContext |= CommitContext;
2043820432
commitPassiveUnmountEffects(root.current);
@@ -20448,10 +20442,6 @@ function flushPassiveEffectsImpl() {
2044820442
}
2044920443
}
2045020444

20451-
{
20452-
isFlushingPassiveEffects = false;
20453-
}
20454-
2045520445
{
2045620446
commitDoubleInvokeEffectsInDEV(root.current, true);
2045720447
}
@@ -20831,86 +20821,6 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) {
2083120821
}
2083220822
}
2083320823

20834-
var didWarnStateUpdateForUnmountedComponent = null;
20835-
20836-
function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
20837-
{
20838-
var tag = fiber.tag;
20839-
20840-
if (
20841-
tag !== HostRoot &&
20842-
tag !== ClassComponent &&
20843-
tag !== FunctionComponent &&
20844-
tag !== ForwardRef &&
20845-
tag !== MemoComponent &&
20846-
tag !== SimpleMemoComponent
20847-
) {
20848-
// Only warn for user-defined components, not internal ones like Suspense.
20849-
return;
20850-
}
20851-
20852-
if ((fiber.flags & PassiveStatic) !== NoFlags) {
20853-
var updateQueue = fiber.updateQueue;
20854-
20855-
if (updateQueue !== null) {
20856-
var lastEffect = updateQueue.lastEffect;
20857-
20858-
if (lastEffect !== null) {
20859-
var firstEffect = lastEffect.next;
20860-
var effect = firstEffect;
20861-
20862-
do {
20863-
if (effect.destroy !== undefined) {
20864-
if ((effect.tag & Passive$1) !== NoFlags$1) {
20865-
return;
20866-
}
20867-
}
20868-
20869-
effect = effect.next;
20870-
} while (effect !== firstEffect);
20871-
}
20872-
}
20873-
} // We show the whole stack but dedupe on the top component's name because
20874-
// the problematic code almost always lies inside that component.
20875-
20876-
var componentName = getComponentNameFromFiber(fiber) || "ReactComponent";
20877-
20878-
if (didWarnStateUpdateForUnmountedComponent !== null) {
20879-
if (didWarnStateUpdateForUnmountedComponent.has(componentName)) {
20880-
return;
20881-
}
20882-
20883-
didWarnStateUpdateForUnmountedComponent.add(componentName);
20884-
} else {
20885-
didWarnStateUpdateForUnmountedComponent = new Set([componentName]);
20886-
}
20887-
20888-
if (isFlushingPassiveEffects);
20889-
else {
20890-
var previousFiber = current;
20891-
20892-
try {
20893-
setCurrentFiber(fiber);
20894-
20895-
error(
20896-
"Can't perform a React state update on an unmounted component. This " +
20897-
"is a no-op, but it indicates a memory leak in your application. To " +
20898-
"fix, cancel all subscriptions and asynchronous tasks in %s.",
20899-
tag === ClassComponent
20900-
? "the componentWillUnmount method"
20901-
: "a useEffect cleanup function"
20902-
);
20903-
} finally {
20904-
if (previousFiber) {
20905-
setCurrentFiber(fiber);
20906-
} else {
20907-
resetCurrentFiber();
20908-
}
20909-
}
20910-
}
20911-
}
20912-
}
20913-
2091420824
var beginWork$1;
2091520825

2091620826
{

0 commit comments

Comments
 (0)