Skip to content

Commit

Permalink
Clean up discrete event replaying (#26558)
Browse files Browse the repository at this point in the history
We no longer replay and discrete events.

I might re-add a form of this but it'll look a little different.

DiffTrain build for [9cfba0f](9cfba0f)
  • Loading branch information
sebmarkbage committed Apr 5, 2023
1 parent 45dac60 commit 267d109
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 @@
790ebc962de573a37e4755207eba91b07a0fa172
9cfba0f6ecc15a342ef184552742c5db6c7f2d3e
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-845af70b";
var ReactVersion = "18.3.0-www-modern-ba4b0f21";

// 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-2747f957";
var ReactVersion = "18.3.0-www-classic-d71a1ab4";

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 @@ -9732,7 +9732,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-8b2723a7",
version: "18.3.0-www-modern-4adf9e4a",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1324 = {
Expand Down Expand Up @@ -9763,7 +9763,7 @@ var internals$jscomp$inline_1324 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-8b2723a7"
reconcilerVersion: "18.3.0-www-modern-4adf9e4a"
};
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 @@ -33380,7 +33380,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-e5fad0ff";
var ReactVersion = "18.3.0-www-classic-c0ecfce3";

function createPortal$1(
children,
Expand Down Expand Up @@ -44086,9 +44086,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 @@ -44469,22 +44467,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 @@ -44504,8 +44486,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 @@ -33219,7 +33219,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-8b2723a7";
var ReactVersion = "18.3.0-www-modern-4adf9e4a";

function createPortal$1(
children,
Expand Down Expand Up @@ -33923,9 +33923,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 @@ -34306,22 +34304,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 @@ -34341,8 +34323,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 @@ -12570,19 +12570,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 @@ -12891,20 +12891,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 @@ -15390,7 +15390,6 @@ function markNodeAsHoistable(node) {
node[internalHoistableMarker] = !0;
}
var hasScheduledReplayAttempt = !1,
queuedDiscreteEvents = [],
queuedFocus = null,
queuedDrag = null,
queuedMouse = null,
Expand Down Expand Up @@ -15630,23 +15629,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 @@ -15968,11 +15959,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 @@ -15984,23 +15975,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 @@ -16012,15 +16003,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 @@ -16079,17 +16070,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-756a5a01",
version: "18.3.0-www-classic-11653adb",
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 @@ -16105,26 +16096,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-756a5a01"
reconcilerVersion: "18.3.0-www-classic-11653adb"
};
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 @@ -16352,4 +16343,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-756a5a01";
exports.version = "18.3.0-www-classic-11653adb";
Loading

0 comments on commit 267d109

Please sign in to comment.