Skip to content

Commit

Permalink
Clean up discrete event replaying (#26558)
Browse files Browse the repository at this point in the history
This reverts commit cc958d2.

DiffTrain build for [7ecfd6d](7ecfd6d)
  • Loading branch information
kassens committed Apr 20, 2023
1 parent f504564 commit 6433b78
Show file tree
Hide file tree
Showing 15 changed files with 451 additions and 577 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6bb84216807f5386d8a83baf9ee464358a68c7bd
7ecfd6dc036fd923e7bdfd090e0956b1eca4323a
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-d63670f9";
var ReactVersion = "18.3.0-www-modern-7cca7bc7";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-classic-afdf1f7f";
var ReactVersion = "18.3.0-www-classic-9409ec15";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9737,7 +9737,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-c4645088",
version: "18.3.0-www-modern-3e5f6beb",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1324 = {
Expand Down Expand Up @@ -9768,7 +9768,7 @@ var internals$jscomp$inline_1324 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-c4645088"
reconcilerVersion: "18.3.0-www-modern-3e5f6beb"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1325 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
26 changes: 4 additions & 22 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -33407,7 +33407,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-5c06c715";
var ReactVersion = "18.3.0-www-classic-731f727b";

function createPortal$1(
children,
Expand Down Expand Up @@ -44113,9 +44113,7 @@ function isOwnedInstance(node) {

// has this definition built-in.

var hasScheduledReplayAttempt = false; // The queue of discrete events to be replayed.

var queuedDiscreteEvents = []; // Indicates if any continuous event targets are non-null for early bailout.
var hasScheduledReplayAttempt = false; // The last of each continuous event type. We only need to replay the last one
// if the last target was dehydrated.

var queuedFocus = null;
Expand Down Expand Up @@ -44496,22 +44494,6 @@ function scheduleCallbackIfUnblocked(queuedEvent, unblocked) {
}

function retryIfBlockedOn(unblocked) {
// Mark anything that was blocked on this as no longer blocked
// and eligible for a replay.
if (queuedDiscreteEvents.length > 0) {
scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked); // This is a exponential search for each boundary that commits. I think it's
// worth it because we expect very few discrete events to queue up and once
// we are actually fully unblocked it will be fast to replay them.

for (var i = 1; i < queuedDiscreteEvents.length; i++) {
var queuedEvent = queuedDiscreteEvents[i];

if (queuedEvent.blockedOn === unblocked) {
queuedEvent.blockedOn = null;
}
}
}

if (queuedFocus !== null) {
scheduleCallbackIfUnblocked(queuedFocus, unblocked);
}
Expand All @@ -44531,8 +44513,8 @@ function retryIfBlockedOn(unblocked) {
queuedPointers.forEach(unblock);
queuedPointerCaptures.forEach(unblock);

for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) {
var queuedTarget = queuedExplicitHydrationTargets[_i];
for (var i = 0; i < queuedExplicitHydrationTargets.length; i++) {
var queuedTarget = queuedExplicitHydrationTargets[i];

if (queuedTarget.blockedOn === unblocked) {
queuedTarget.blockedOn = null;
Expand Down
26 changes: 4 additions & 22 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -33246,7 +33246,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-c4645088";
var ReactVersion = "18.3.0-www-modern-3e5f6beb";

function createPortal$1(
children,
Expand Down Expand Up @@ -33950,9 +33950,7 @@ if (canUseDOM) {

// has this definition built-in.

var hasScheduledReplayAttempt = false; // The queue of discrete events to be replayed.

var queuedDiscreteEvents = []; // Indicates if any continuous event targets are non-null for early bailout.
var hasScheduledReplayAttempt = false; // The last of each continuous event type. We only need to replay the last one
// if the last target was dehydrated.

var queuedFocus = null;
Expand Down Expand Up @@ -34333,22 +34331,6 @@ function scheduleCallbackIfUnblocked(queuedEvent, unblocked) {
}

function retryIfBlockedOn(unblocked) {
// Mark anything that was blocked on this as no longer blocked
// and eligible for a replay.
if (queuedDiscreteEvents.length > 0) {
scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked); // This is a exponential search for each boundary that commits. I think it's
// worth it because we expect very few discrete events to queue up and once
// we are actually fully unblocked it will be fast to replay them.

for (var i = 1; i < queuedDiscreteEvents.length; i++) {
var queuedEvent = queuedDiscreteEvents[i];

if (queuedEvent.blockedOn === unblocked) {
queuedEvent.blockedOn = null;
}
}
}

if (queuedFocus !== null) {
scheduleCallbackIfUnblocked(queuedFocus, unblocked);
}
Expand All @@ -34368,8 +34350,8 @@ function retryIfBlockedOn(unblocked) {
queuedPointers.forEach(unblock);
queuedPointerCaptures.forEach(unblock);

for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) {
var queuedTarget = queuedExplicitHydrationTargets[_i];
for (var i = 0; i < queuedExplicitHydrationTargets.length; i++) {
var queuedTarget = queuedExplicitHydrationTargets[i];

if (queuedTarget.blockedOn === unblocked) {
queuedTarget.blockedOn = null;
Expand Down
119 changes: 55 additions & 64 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12575,19 +12575,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) {
}
var isInputEventSupported = !1;
if (canUseDOM) {
var JSCompiler_inline_result$jscomp$335;
var JSCompiler_inline_result$jscomp$334;
if (canUseDOM) {
var isSupported$jscomp$inline_1568 = "oninput" in document;
if (!isSupported$jscomp$inline_1568) {
var element$jscomp$inline_1569 = document.createElement("div");
element$jscomp$inline_1569.setAttribute("oninput", "return;");
isSupported$jscomp$inline_1568 =
"function" === typeof element$jscomp$inline_1569.oninput;
var isSupported$jscomp$inline_1567 = "oninput" in document;
if (!isSupported$jscomp$inline_1567) {
var element$jscomp$inline_1568 = document.createElement("div");
element$jscomp$inline_1568.setAttribute("oninput", "return;");
isSupported$jscomp$inline_1567 =
"function" === typeof element$jscomp$inline_1568.oninput;
}
JSCompiler_inline_result$jscomp$335 = isSupported$jscomp$inline_1568;
} else JSCompiler_inline_result$jscomp$335 = !1;
JSCompiler_inline_result$jscomp$334 = isSupported$jscomp$inline_1567;
} else JSCompiler_inline_result$jscomp$334 = !1;
isInputEventSupported =
JSCompiler_inline_result$jscomp$335 &&
JSCompiler_inline_result$jscomp$334 &&
(!document.documentMode || 9 < document.documentMode);
}
function stopWatchingForValueChange() {
Expand Down Expand Up @@ -12896,20 +12896,20 @@ function registerSimpleEvent(domEventName, reactName) {
registerTwoPhaseEvent(reactName, [domEventName]);
}
for (
var i$jscomp$inline_1609 = 0;
i$jscomp$inline_1609 < simpleEventPluginEvents.length;
i$jscomp$inline_1609++
var i$jscomp$inline_1608 = 0;
i$jscomp$inline_1608 < simpleEventPluginEvents.length;
i$jscomp$inline_1608++
) {
var eventName$jscomp$inline_1610 =
simpleEventPluginEvents[i$jscomp$inline_1609],
domEventName$jscomp$inline_1611 =
eventName$jscomp$inline_1610.toLowerCase(),
capitalizedEvent$jscomp$inline_1612 =
eventName$jscomp$inline_1610[0].toUpperCase() +
eventName$jscomp$inline_1610.slice(1);
var eventName$jscomp$inline_1609 =
simpleEventPluginEvents[i$jscomp$inline_1608],
domEventName$jscomp$inline_1610 =
eventName$jscomp$inline_1609.toLowerCase(),
capitalizedEvent$jscomp$inline_1611 =
eventName$jscomp$inline_1609[0].toUpperCase() +
eventName$jscomp$inline_1609.slice(1);
registerSimpleEvent(
domEventName$jscomp$inline_1611,
"on" + capitalizedEvent$jscomp$inline_1612
domEventName$jscomp$inline_1610,
"on" + capitalizedEvent$jscomp$inline_1611
);
}
registerSimpleEvent(ANIMATION_END, "onAnimationEnd");
Expand Down Expand Up @@ -15395,7 +15395,6 @@ function markNodeAsHoistable(node) {
node[internalHoistableMarker] = !0;
}
var hasScheduledReplayAttempt = !1,
queuedDiscreteEvents = [],
queuedFocus = null,
queuedDrag = null,
queuedMouse = null,
Expand Down Expand Up @@ -15635,23 +15634,15 @@ function retryIfBlockedOn(unblocked) {
function unblock(queuedEvent) {
return scheduleCallbackIfUnblocked(queuedEvent, unblocked);
}
if (0 < queuedDiscreteEvents.length) {
scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked);
for (var i = 1; i < queuedDiscreteEvents.length; i++) {
var queuedEvent$jscomp$0 = queuedDiscreteEvents[i];
queuedEvent$jscomp$0.blockedOn === unblocked &&
(queuedEvent$jscomp$0.blockedOn = null);
}
}
null !== queuedFocus && scheduleCallbackIfUnblocked(queuedFocus, unblocked);
null !== queuedDrag && scheduleCallbackIfUnblocked(queuedDrag, unblocked);
null !== queuedMouse && scheduleCallbackIfUnblocked(queuedMouse, unblocked);
queuedPointers.forEach(unblock);
queuedPointerCaptures.forEach(unblock);
for (i = 0; i < queuedExplicitHydrationTargets.length; i++)
(queuedEvent$jscomp$0 = queuedExplicitHydrationTargets[i]),
queuedEvent$jscomp$0.blockedOn === unblocked &&
(queuedEvent$jscomp$0.blockedOn = null);
for (var i = 0; i < queuedExplicitHydrationTargets.length; i++) {
var queuedTarget = queuedExplicitHydrationTargets[i];
queuedTarget.blockedOn === unblocked && (queuedTarget.blockedOn = null);
}
for (
;
0 < queuedExplicitHydrationTargets.length &&
Expand Down Expand Up @@ -15973,11 +15964,11 @@ function legacyCreateRootFromDOMContainer(
if ("function" === typeof callback) {
var originalCallback = callback;
callback = function () {
var instance = getPublicRootInstance(root$263);
var instance = getPublicRootInstance(root$262);
originalCallback.call(instance);
};
}
var root$263 = createHydrationContainer(
var root$262 = createHydrationContainer(
initialChildren,
callback,
container,
Expand All @@ -15989,23 +15980,23 @@ function legacyCreateRootFromDOMContainer(
noopOnRecoverableError,
null
);
container._reactRootContainer = root$263;
container[internalContainerInstanceKey] = root$263.current;
container._reactRootContainer = root$262;
container[internalContainerInstanceKey] = root$262.current;
listenToAllSupportedEvents(
8 === container.nodeType ? container.parentNode : container
);
flushSync$1();
return root$263;
return root$262;
}
clearContainer(container);
if ("function" === typeof callback) {
var originalCallback$264 = callback;
var originalCallback$263 = callback;
callback = function () {
var instance = getPublicRootInstance(root$265);
originalCallback$264.call(instance);
var instance = getPublicRootInstance(root$264);
originalCallback$263.call(instance);
};
}
var root$265 = createFiberRoot(
var root$264 = createFiberRoot(
container,
0,
!1,
Expand All @@ -16017,15 +16008,15 @@ function legacyCreateRootFromDOMContainer(
noopOnRecoverableError,
null
);
container._reactRootContainer = root$265;
container[internalContainerInstanceKey] = root$265.current;
container._reactRootContainer = root$264;
container[internalContainerInstanceKey] = root$264.current;
listenToAllSupportedEvents(
8 === container.nodeType ? container.parentNode : container
);
flushSync$1(function () {
updateContainer(initialChildren, root$265, parentComponent, callback);
updateContainer(initialChildren, root$264, parentComponent, callback);
});
return root$265;
return root$264;
}
function legacyRenderSubtreeIntoContainer(
parentComponent,
Expand Down Expand Up @@ -16084,17 +16075,17 @@ Internals.Events = [
restoreStateIfNeeded,
batchedUpdates$1
];
var devToolsConfig$jscomp$inline_1827 = {
var devToolsConfig$jscomp$inline_1826 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-253ebf19",
version: "18.3.0-www-classic-5ce3ec5f",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2196 = {
bundleType: devToolsConfig$jscomp$inline_1827.bundleType,
version: devToolsConfig$jscomp$inline_1827.version,
rendererPackageName: devToolsConfig$jscomp$inline_1827.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1827.rendererConfig,
var internals$jscomp$inline_2195 = {
bundleType: devToolsConfig$jscomp$inline_1826.bundleType,
version: devToolsConfig$jscomp$inline_1826.version,
rendererPackageName: devToolsConfig$jscomp$inline_1826.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1826.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -16110,26 +16101,26 @@ var internals$jscomp$inline_2196 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1827.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1826.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-253ebf19"
reconcilerVersion: "18.3.0-www-classic-5ce3ec5f"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2197 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_2196 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_2197.isDisabled &&
hook$jscomp$inline_2197.supportsFiber
!hook$jscomp$inline_2196.isDisabled &&
hook$jscomp$inline_2196.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_2197.inject(
internals$jscomp$inline_2196
(rendererID = hook$jscomp$inline_2196.inject(
internals$jscomp$inline_2195
)),
(injectedHook = hook$jscomp$inline_2197);
(injectedHook = hook$jscomp$inline_2196);
} catch (err) {}
}
assign(Internals, {
Expand Down Expand Up @@ -16357,4 +16348,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-253ebf19";
exports.version = "18.3.0-www-classic-5ce3ec5f";
Loading

0 comments on commit 6433b78

Please sign in to comment.