Skip to content

Commit

Permalink
Remove unstable_flushControlled (#26397)
Browse files Browse the repository at this point in the history
This API has been fully replaced by `flushSync`.

DiffTrain build for [99aa082](99aa082)
  • Loading branch information
kassens committed Mar 15, 2023
1 parent 969ad1d commit 923bb20
Show file tree
Hide file tree
Showing 16 changed files with 218 additions and 412 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cfc1274e3be5a93a4c93f8fb87f2109993afe1dd
99aa082be0a2a62fef8ed747348ddf85c5641902
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-addde25e";
var ReactVersion = "18.3.0-www-modern-269fc792";

// ATTENTION
// When adding new symbols to this file,
Expand Down
4 changes: 2 additions & 2 deletions 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-773bb029";
var ReactVersion = "18.3.0-www-classic-fb88bc59";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -24208,7 +24208,7 @@ function flushSync(fn) {
function isInvalidExecutionContextForEventFunction() {
// Used to throw if certain APIs are called from the wrong context.
return (executionContext & RenderContext) !== NoContext;
}
} // This is called by the HiddenContext module when we enter or leave a
// hidden subtree. The stack logic is managed there because that's the only
// place that ever modifies it. Which module it lives in doesn't matter for
// performance because this function will get inlined regardless
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-dev.modern.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-modern-ee471100";
var ReactVersion = "18.3.0-www-modern-80930f5c";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -23868,7 +23868,7 @@ function flushSync(fn) {
function isInvalidExecutionContextForEventFunction() {
// Used to throw if certain APIs are called from the wrong context.
return (executionContext & RenderContext) !== NoContext;
}
} // This is called by the HiddenContext module when we enter or leave a
// hidden subtree. The stack logic is managed there because that's the only
// place that ever modifies it. Which module it lives in doesn't matter for
// performance because this function will get inlined regardless
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 @@ -9555,7 +9555,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-990522b1",
version: "18.3.0-www-modern-d2d40a82",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1283 = {
Expand Down Expand Up @@ -9586,7 +9586,7 @@ var internals$jscomp$inline_1283 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-990522b1"
reconcilerVersion: "18.3.0-www-modern-d2d40a82"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1284 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
25 changes: 1 addition & 24 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -34796,28 +34796,6 @@ function isAlreadyRendering() {
function isInvalidExecutionContextForEventFunction() {
// Used to throw if certain APIs are called from the wrong context.
return (executionContext & RenderContext) !== NoContext;
}
function flushControlled(fn) {
var prevExecutionContext = executionContext;
executionContext |= BatchedContext;
var prevTransition = ReactCurrentBatchConfig$1.transition;
var previousPriority = getCurrentUpdatePriority();

try {
ReactCurrentBatchConfig$1.transition = null;
setCurrentUpdatePriority(DiscreteEventPriority);
fn();
} finally {
setCurrentUpdatePriority(previousPriority);
ReactCurrentBatchConfig$1.transition = prevTransition;
executionContext = prevExecutionContext;

if (executionContext === NoContext) {
// Flush the immediate callbacks that were scheduled during this batch
resetRenderTimer();
flushSyncCallbacks();
}
}
} // This is called by the HiddenContext module when we enter or leave a
// hidden subtree. The stack logic is managed there because that's the only
// place that ever modifies it. Which module it lives in doesn't matter for
Expand Down Expand Up @@ -38347,7 +38325,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-036f93df";
var ReactVersion = "18.3.0-www-classic-da9cec21";

function createPortal$1(
children,
Expand Down Expand Up @@ -44209,7 +44187,6 @@ exports.render = render;
exports.unmountComponentAtNode = unmountComponentAtNode;
exports.unstable_batchedUpdates = batchedUpdates$1;
exports.unstable_createEventHandle = createEventHandle;
exports.unstable_flushControlled = flushControlled;
exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
exports.unstable_runWithPriority = runWithPriority;
exports.version = ReactVersion;
Expand Down
25 changes: 1 addition & 24 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -29582,28 +29582,6 @@ function isAlreadyRendering() {
function isInvalidExecutionContextForEventFunction() {
// Used to throw if certain APIs are called from the wrong context.
return (executionContext & RenderContext) !== NoContext;
}
function flushControlled(fn) {
var prevExecutionContext = executionContext;
executionContext |= BatchedContext;
var prevTransition = ReactCurrentBatchConfig$1.transition;
var previousPriority = getCurrentUpdatePriority();

try {
ReactCurrentBatchConfig$1.transition = null;
setCurrentUpdatePriority(DiscreteEventPriority);
fn();
} finally {
setCurrentUpdatePriority(previousPriority);
ReactCurrentBatchConfig$1.transition = prevTransition;
executionContext = prevExecutionContext;

if (executionContext === NoContext) {
// Flush the immediate callbacks that were scheduled during this batch
resetRenderTimer();
flushSyncCallbacks();
}
}
} // This is called by the HiddenContext module when we enter or leave a
// hidden subtree. The stack logic is managed there because that's the only
// place that ever modifies it. Which module it lives in doesn't matter for
Expand Down Expand Up @@ -33133,7 +33111,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-990522b1";
var ReactVersion = "18.3.0-www-modern-d2d40a82";

function createPortal$1(
children,
Expand Down Expand Up @@ -43282,7 +43260,6 @@ exports.preinit = preinit;
exports.preload = preload;
exports.unstable_batchedUpdates = batchedUpdates$1;
exports.unstable_createEventHandle = createEventHandle;
exports.unstable_flushControlled = flushControlled;
exports.unstable_runWithPriority = runWithPriority;
exports.version = ReactVersion;

Expand Down
85 changes: 34 additions & 51 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10866,9 +10866,6 @@ function addTransitionProgressCallbackToPendingTransition(
boundaries
));
}
function resetRenderTimer() {
workInProgressRootRenderTargetTime = now() + 500;
}
var hasUncaughtError = !1,
firstUncaughtError = null,
legacyErrorBoundariesThatAlreadyFailed = null,
Expand Down Expand Up @@ -10941,7 +10938,8 @@ function scheduleUpdateOnFiber(root, fiber, lane, eventTime) {
2 === lane &&
0 === executionContext &&
0 === (fiber.mode & 1) &&
(resetRenderTimer(), includesLegacySyncCallbacks && flushSyncCallbacks());
((workInProgressRootRenderTargetTime = now() + 500),
includesLegacySyncCallbacks && flushSyncCallbacks());
}
}
function ensureRootIsScheduled(root, currentTime) {
Expand Down Expand Up @@ -11294,7 +11292,7 @@ function batchedUpdates$1(fn, a) {
} finally {
(executionContext = prevExecutionContext),
0 === executionContext &&
(resetRenderTimer(),
((workInProgressRootRenderTargetTime = now() + 500),
includesLegacySyncCallbacks && flushSyncCallbacks());
}
}
Expand Down Expand Up @@ -11477,7 +11475,7 @@ function renderRootConcurrent(root, lanes) {
prevCacheDispatcher = pushCacheDispatcher();
if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes)
(workInProgressTransitions = getTransitionsForLanes(root, lanes)),
resetRenderTimer(),
(workInProgressRootRenderTargetTime = now() + 500),
prepareFreshStack(root, lanes);
a: do
try {
Expand Down Expand Up @@ -13278,7 +13276,8 @@ function attemptSynchronousHydration(fiber) {
(markRootEntangled(root$208, lanes | 2),
ensureRootIsScheduled(root$208, now()),
0 === (executionContext & 6) &&
(resetRenderTimer(), flushSyncCallbacks()));
((workInProgressRootRenderTargetTime = now() + 500),
flushSyncCallbacks()));
}
break;
case 13:
Expand Down Expand Up @@ -13849,14 +13848,14 @@ var isInputEventSupported = !1;
if (canUseDOM) {
var JSCompiler_inline_result$jscomp$309;
if (canUseDOM) {
var isSupported$jscomp$inline_1570 = "oninput" in document;
if (!isSupported$jscomp$inline_1570) {
var element$jscomp$inline_1571 = document.createElement("div");
element$jscomp$inline_1571.setAttribute("oninput", "return;");
isSupported$jscomp$inline_1570 =
"function" === typeof element$jscomp$inline_1571.oninput;
var isSupported$jscomp$inline_1566 = "oninput" in document;
if (!isSupported$jscomp$inline_1566) {
var element$jscomp$inline_1567 = document.createElement("div");
element$jscomp$inline_1567.setAttribute("oninput", "return;");
isSupported$jscomp$inline_1566 =
"function" === typeof element$jscomp$inline_1567.oninput;
}
JSCompiler_inline_result$jscomp$309 = isSupported$jscomp$inline_1570;
JSCompiler_inline_result$jscomp$309 = isSupported$jscomp$inline_1566;
} else JSCompiler_inline_result$jscomp$309 = !1;
isInputEventSupported =
JSCompiler_inline_result$jscomp$309 &&
Expand Down Expand Up @@ -13997,20 +13996,20 @@ function registerSimpleEvent(domEventName, reactName) {
registerTwoPhaseEvent(reactName, [domEventName]);
}
for (
var i$jscomp$inline_1583 = 0;
i$jscomp$inline_1583 < simpleEventPluginEvents.length;
i$jscomp$inline_1583++
var i$jscomp$inline_1579 = 0;
i$jscomp$inline_1579 < simpleEventPluginEvents.length;
i$jscomp$inline_1579++
) {
var eventName$jscomp$inline_1584 =
simpleEventPluginEvents[i$jscomp$inline_1583],
domEventName$jscomp$inline_1585 =
eventName$jscomp$inline_1584.toLowerCase(),
capitalizedEvent$jscomp$inline_1586 =
eventName$jscomp$inline_1584[0].toUpperCase() +
eventName$jscomp$inline_1584.slice(1);
var eventName$jscomp$inline_1580 =
simpleEventPluginEvents[i$jscomp$inline_1579],
domEventName$jscomp$inline_1581 =
eventName$jscomp$inline_1580.toLowerCase(),
capitalizedEvent$jscomp$inline_1582 =
eventName$jscomp$inline_1580[0].toUpperCase() +
eventName$jscomp$inline_1580.slice(1);
registerSimpleEvent(
domEventName$jscomp$inline_1585,
"on" + capitalizedEvent$jscomp$inline_1586
domEventName$jscomp$inline_1581,
"on" + capitalizedEvent$jscomp$inline_1582
);
}
registerSimpleEvent(ANIMATION_END, "onAnimationEnd");
Expand Down Expand Up @@ -15700,17 +15699,17 @@ Internals.Events = [
restoreStateIfNeeded,
batchedUpdates$1
];
var devToolsConfig$jscomp$inline_1739 = {
var devToolsConfig$jscomp$inline_1735 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-0ef1f7ef",
version: "18.3.0-www-classic-55fee6a8",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2127 = {
bundleType: devToolsConfig$jscomp$inline_1739.bundleType,
version: devToolsConfig$jscomp$inline_1739.version,
rendererPackageName: devToolsConfig$jscomp$inline_1739.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1739.rendererConfig,
bundleType: devToolsConfig$jscomp$inline_1735.bundleType,
version: devToolsConfig$jscomp$inline_1735.version,
rendererPackageName: devToolsConfig$jscomp$inline_1735.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1735.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -15726,14 +15725,14 @@ var internals$jscomp$inline_2127 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1739.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1735.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-0ef1f7ef"
reconcilerVersion: "18.3.0-www-classic-55fee6a8"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2128 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -15954,22 +15953,6 @@ exports.unstable_createEventHandle = function (type, options) {
"boolean" === typeof options && (isCapturePhaseListener = options));
return eventHandle;
};
exports.unstable_flushControlled = function (fn) {
var prevExecutionContext = executionContext;
executionContext |= 1;
var prevTransition = ReactCurrentBatchConfig$1.transition,
previousPriority = currentUpdatePriority;
try {
(ReactCurrentBatchConfig$1.transition = null),
(currentUpdatePriority = 2),
fn();
} finally {
(currentUpdatePriority = previousPriority),
(ReactCurrentBatchConfig$1.transition = prevTransition),
(executionContext = prevExecutionContext),
0 === executionContext && (resetRenderTimer(), flushSyncCallbacks());
}
};
exports.unstable_renderSubtreeIntoContainer = function (
parentComponent,
element,
Expand All @@ -15989,4 +15972,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-0ef1f7ef";
exports.version = "18.3.0-www-classic-55fee6a8";
Loading

0 comments on commit 923bb20

Please sign in to comment.