Skip to content

Commit ffcaae0

Browse files
committed
[Fizz] Delay retrying hydration until after an animation frame (facebook#34220)
The theory here is that when we reveal a boundary coming from the server we want to paint that before hydrating it. Hydration gets scheduled in a macrotask with the scheduler but it's in theory possible that it runs before the paint. If that's the case, then the JS that runs before yielding during hydration might slightly delay the paint and we might miss a window to skip the previous paint. DiffTrain build for [7a36dfe](facebook@7a36dfe)
1 parent ae58cb1 commit ffcaae0

26 files changed

+6437
-9930
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.2.0-native-fb-8dba9311-20250815
1+
19.2.0-native-fb-7a36dfed-20250816

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<8f585f8d0c4c2591b35cd5015653bb8f>>
10+
* @generated SignedSource<<11f7fbeca93520bb4074827e7a47e8d7>>
1111
*/
1212

1313
"use strict";
@@ -404,5 +404,5 @@ __DEV__ &&
404404
exports.useFormStatus = function () {
405405
return resolveDispatcher().useHostTransitionStatus();
406406
};
407-
exports.version = "19.2.0-native-fb-8dba9311-20250815";
407+
exports.version = "19.2.0-native-fb-7a36dfed-20250816";
408408
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<5118373f45f8737502c0e66710452671>>
10+
* @generated SignedSource<<f2c875378015dd45cf64ae90c070ff2e>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.2.0-native-fb-8dba9311-20250815";
206+
exports.version = "19.2.0-native-fb-7a36dfed-20250816";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<5118373f45f8737502c0e66710452671>>
10+
* @generated SignedSource<<f2c875378015dd45cf64ae90c070ff2e>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.2.0-native-fb-8dba9311-20250815";
206+
exports.version = "19.2.0-native-fb-7a36dfed-20250816";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js

Lines changed: 167 additions & 170 deletions
Large diffs are not rendered by default.

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js

Lines changed: 57 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<73e3d9ea41ac8a1b2a89a71c1edcc743>>
10+
* @generated SignedSource<<0ff75fb9a04be85470769b3d0d04f696>>
1111
*/
1212

1313
/*
@@ -15159,35 +15159,32 @@ FragmentInstance.prototype.compareDocumentPosition = function (otherNode) {
1515915159
void 0
1516015160
);
1516115161
var parentHostInstance = getInstanceFromHostFiber(parentHostFiber);
15162-
if (0 === children.length)
15163-
return (
15164-
(parentHostFiber = children =
15165-
parentHostInstance.compareDocumentPosition(otherNode)),
15166-
parentHostInstance === otherNode
15167-
? (parentHostFiber = Node.DOCUMENT_POSITION_CONTAINS)
15168-
: children & Node.DOCUMENT_POSITION_CONTAINED_BY &&
15169-
(traverseVisibleHostChildren(
15170-
this._fragmentFiber.sibling,
15171-
!1,
15172-
findNextSibling
15173-
),
15174-
(children = searchTarget),
15175-
(searchTarget = null),
15176-
null === children
15177-
? (parentHostFiber = Node.DOCUMENT_POSITION_PRECEDING)
15178-
: ((otherNode =
15179-
getInstanceFromHostFiber(children).compareDocumentPosition(
15180-
otherNode
15181-
)),
15182-
(parentHostFiber =
15183-
0 === otherNode || otherNode & Node.DOCUMENT_POSITION_FOLLOWING
15184-
? Node.DOCUMENT_POSITION_FOLLOWING
15185-
: Node.DOCUMENT_POSITION_PRECEDING))),
15186-
(parentHostFiber |= Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)
15187-
);
15162+
if (0 === children.length) {
15163+
children = this._fragmentFiber;
15164+
var parentResult = parentHostInstance.compareDocumentPosition(otherNode);
15165+
parentHostFiber = parentResult;
15166+
parentHostInstance === otherNode
15167+
? (parentHostFiber = Node.DOCUMENT_POSITION_CONTAINS)
15168+
: parentResult & Node.DOCUMENT_POSITION_CONTAINED_BY &&
15169+
(traverseVisibleHostChildren(children.sibling, !1, findNextSibling),
15170+
(children = searchTarget),
15171+
(searchTarget = null),
15172+
null === children
15173+
? (parentHostFiber = Node.DOCUMENT_POSITION_PRECEDING)
15174+
: ((otherNode =
15175+
getInstanceFromHostFiber(children).compareDocumentPosition(
15176+
otherNode
15177+
)),
15178+
(parentHostFiber =
15179+
0 === otherNode || otherNode & Node.DOCUMENT_POSITION_FOLLOWING
15180+
? Node.DOCUMENT_POSITION_FOLLOWING
15181+
: Node.DOCUMENT_POSITION_PRECEDING)));
15182+
return (parentHostFiber |= Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC);
15183+
}
1518815184
parentHostFiber = getInstanceFromHostFiber(children[0]);
15185+
parentResult = getInstanceFromHostFiber(children[children.length - 1]);
1518915186
for (
15190-
var lastElement = getInstanceFromHostFiber(children[children.length - 1]),
15187+
var firstInstance = getInstanceFromHostFiber(children[0]),
1519115188
foundPortalParent = !1,
1519215189
parent = this._fragmentFiber.return;
1519315190
null !== parent;
@@ -15197,36 +15194,36 @@ FragmentInstance.prototype.compareDocumentPosition = function (otherNode) {
1519715194
if (3 === parent.tag || 5 === parent.tag) break;
1519815195
parent = parent.return;
1519915196
}
15200-
foundPortalParent = foundPortalParent
15201-
? getInstanceFromHostFiber(children[0]).parentElement
15197+
firstInstance = foundPortalParent
15198+
? firstInstance.parentElement
1520215199
: parentHostInstance;
15203-
if (null == foundPortalParent) return Node.DOCUMENT_POSITION_DISCONNECTED;
15200+
if (null == firstInstance) return Node.DOCUMENT_POSITION_DISCONNECTED;
1520415201
parentHostInstance =
15205-
foundPortalParent.compareDocumentPosition(parentHostFiber) &
15202+
firstInstance.compareDocumentPosition(parentHostFiber) &
1520615203
Node.DOCUMENT_POSITION_CONTAINED_BY;
15207-
foundPortalParent =
15208-
foundPortalParent.compareDocumentPosition(lastElement) &
15204+
firstInstance =
15205+
firstInstance.compareDocumentPosition(parentResult) &
1520915206
Node.DOCUMENT_POSITION_CONTAINED_BY;
15210-
parent = parentHostFiber.compareDocumentPosition(otherNode);
15211-
var lastResult = lastElement.compareDocumentPosition(otherNode),
15212-
otherNodeIsWithinFirstOrLastChild =
15213-
parent & Node.DOCUMENT_POSITION_CONTAINED_BY ||
15214-
lastResult & Node.DOCUMENT_POSITION_CONTAINED_BY;
15207+
foundPortalParent = parentHostFiber.compareDocumentPosition(otherNode);
15208+
var lastResult = parentResult.compareDocumentPosition(otherNode);
15209+
parent =
15210+
foundPortalParent & Node.DOCUMENT_POSITION_CONTAINED_BY ||
15211+
lastResult & Node.DOCUMENT_POSITION_CONTAINED_BY;
1521515212
lastResult =
1521615213
parentHostInstance &&
15217-
foundPortalParent &&
15218-
parent & Node.DOCUMENT_POSITION_FOLLOWING &&
15214+
firstInstance &&
15215+
foundPortalParent & Node.DOCUMENT_POSITION_FOLLOWING &&
1521915216
lastResult & Node.DOCUMENT_POSITION_PRECEDING;
1522015217
parentHostFiber =
1522115218
(parentHostInstance && parentHostFiber === otherNode) ||
15222-
(foundPortalParent && lastElement === otherNode) ||
15223-
otherNodeIsWithinFirstOrLastChild ||
15219+
(firstInstance && parentResult === otherNode) ||
15220+
parent ||
1522415221
lastResult
1522515222
? Node.DOCUMENT_POSITION_CONTAINED_BY
1522615223
: (!parentHostInstance && parentHostFiber === otherNode) ||
15227-
(!foundPortalParent && lastElement === otherNode)
15224+
(!firstInstance && parentResult === otherNode)
1522815225
? Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
15229-
: parent;
15226+
: foundPortalParent;
1523015227
return parentHostFiber & Node.DOCUMENT_POSITION_DISCONNECTED ||
1523115228
parentHostFiber & Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC ||
1523215229
validateDocumentPositionWithFiberTree(
@@ -17190,16 +17187,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1719017187
0 === i && attemptExplicitHydrationTarget(target);
1719117188
}
1719217189
};
17193-
var isomorphicReactPackageVersion$jscomp$inline_2016 = React.version;
17190+
var isomorphicReactPackageVersion$jscomp$inline_2023 = React.version;
1719417191
if (
17195-
"19.2.0-native-fb-8dba9311-20250815" !==
17196-
isomorphicReactPackageVersion$jscomp$inline_2016
17192+
"19.2.0-native-fb-7a36dfed-20250816" !==
17193+
isomorphicReactPackageVersion$jscomp$inline_2023
1719717194
)
1719817195
throw Error(
1719917196
formatProdErrorMessage(
1720017197
527,
17201-
isomorphicReactPackageVersion$jscomp$inline_2016,
17202-
"19.2.0-native-fb-8dba9311-20250815"
17198+
isomorphicReactPackageVersion$jscomp$inline_2023,
17199+
"19.2.0-native-fb-7a36dfed-20250816"
1720317200
)
1720417201
);
1720517202
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17219,24 +17216,24 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1721917216
null === componentOrElement ? null : componentOrElement.stateNode;
1722017217
return componentOrElement;
1722117218
};
17222-
var internals$jscomp$inline_2545 = {
17219+
var internals$jscomp$inline_2554 = {
1722317220
bundleType: 0,
17224-
version: "19.2.0-native-fb-8dba9311-20250815",
17221+
version: "19.2.0-native-fb-7a36dfed-20250816",
1722517222
rendererPackageName: "react-dom",
1722617223
currentDispatcherRef: ReactSharedInternals,
17227-
reconcilerVersion: "19.2.0-native-fb-8dba9311-20250815"
17224+
reconcilerVersion: "19.2.0-native-fb-7a36dfed-20250816"
1722817225
};
1722917226
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
17230-
var hook$jscomp$inline_2546 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
17227+
var hook$jscomp$inline_2555 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
1723117228
if (
17232-
!hook$jscomp$inline_2546.isDisabled &&
17233-
hook$jscomp$inline_2546.supportsFiber
17229+
!hook$jscomp$inline_2555.isDisabled &&
17230+
hook$jscomp$inline_2555.supportsFiber
1723417231
)
1723517232
try {
17236-
(rendererID = hook$jscomp$inline_2546.inject(
17237-
internals$jscomp$inline_2545
17233+
(rendererID = hook$jscomp$inline_2555.inject(
17234+
internals$jscomp$inline_2554
1723817235
)),
17239-
(injectedHook = hook$jscomp$inline_2546);
17236+
(injectedHook = hook$jscomp$inline_2555);
1724017237
} catch (err) {}
1724117238
}
1724217239
exports.createRoot = function (container, options) {
@@ -17322,4 +17319,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1732217319
listenToAllSupportedEvents(container);
1732317320
return new ReactDOMHydrationRoot(initialChildren);
1732417321
};
17325-
exports.version = "19.2.0-native-fb-8dba9311-20250815";
17322+
exports.version = "19.2.0-native-fb-7a36dfed-20250816";

0 commit comments

Comments
 (0)