Skip to content

Commit

Permalink
useOptimisticState -> useOptimistic (#26772)
Browse files Browse the repository at this point in the history
Drop the "state". Just "useOptimistic". It's cleaner.

This is still an experimental API. May not be the final name.

DiffTrain build for commit b797282.
  • Loading branch information
acdlite committed May 3, 2023
1 parent ff0533f commit 4adb0ac
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23918,7 +23918,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-388686f29-20230503";
var ReactVersion = "18.3.0-canary-b7972822b-20230503";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8623,7 +8623,7 @@ var devToolsConfig$jscomp$inline_1039 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-388686f29-20230503",
version: "18.3.0-canary-b7972822b-20230503",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1238 = {
Expand Down Expand Up @@ -8654,7 +8654,7 @@ var internals$jscomp$inline_1238 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-388686f29-20230503"
reconcilerVersion: "18.3.0-canary-b7972822b-20230503"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1239 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9049,7 +9049,7 @@ var devToolsConfig$jscomp$inline_1081 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-388686f29-20230503",
version: "18.3.0-canary-b7972822b-20230503",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1279 = {
Expand Down Expand Up @@ -9080,7 +9080,7 @@ var internals$jscomp$inline_1279 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-388686f29-20230503"
reconcilerVersion: "18.3.0-canary-b7972822b-20230503"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1280 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<21b04a040ed4292372f9e9ab8319a3b5>>
* @generated SignedSource<<452f0f8d322ebca41e7548836de1f7a3>>
*/

'use strict';
Expand All @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-388686f29-20230503";
var ReactVersion = "18.3.0-canary-b7972822b-20230503";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -2088,10 +2088,10 @@ function useEffectEvent(callback) {

return dispatcher.useEffectEvent(callback);
}
function useOptimisticState(passthrough, reducer) {
function useOptimistic(passthrough, reducer) {
var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional

return dispatcher.useOptimisticState(passthrough, reducer);
return dispatcher.useOptimistic(passthrough, reducer);
}

function describeBuiltInComponentFrame(name, source, ownerFn) {
Expand Down Expand Up @@ -3935,7 +3935,7 @@ exports.createMutableSource = createMutableSource;
exports.createRef = createRef;
exports.createServerContext = createServerContext;
exports.experimental_useEffectEvent = useEffectEvent;
exports.experimental_useOptimisticState = useOptimisticState;
exports.experimental_useOptimistic = useOptimistic;
exports.forwardRef = forwardRef;
exports.isValidElement = isValidElement$1;
exports.jsx = jsx;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a5cef1c7009114f63f7485ab232c4292>>
* @generated SignedSource<<8bda7f5ab238068ff35a9e318f69e44f>>
*/

"use strict";
Expand Down Expand Up @@ -529,11 +529,8 @@ exports.createServerContext = function (globalName, defaultValue) {
exports.experimental_useEffectEvent = function (callback) {
return ReactCurrentDispatcher.current.useEffectEvent(callback);
};
exports.experimental_useOptimisticState = function (passthrough, reducer) {
return ReactCurrentDispatcher.current.useOptimisticState(
passthrough,
reducer
);
exports.experimental_useOptimistic = function (passthrough, reducer) {
return ReactCurrentDispatcher.current.useOptimistic(passthrough, reducer);
};
exports.forwardRef = function (render) {
return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
Expand Down Expand Up @@ -645,4 +642,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-canary-388686f29-20230503";
exports.version = "18.3.0-canary-b7972822b-20230503";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<01e7e919f906241f0982e36bc83f25c1>>
* @generated SignedSource<<e51ed23dd0f2d528ac2b6b54b3267d38>>
*/


Expand Down Expand Up @@ -533,11 +533,8 @@ exports.createServerContext = function (globalName, defaultValue) {
exports.experimental_useEffectEvent = function (callback) {
return ReactCurrentDispatcher.current.useEffectEvent(callback);
};
exports.experimental_useOptimisticState = function (passthrough, reducer) {
return ReactCurrentDispatcher.current.useOptimisticState(
passthrough,
reducer
);
exports.experimental_useOptimistic = function (passthrough, reducer) {
return ReactCurrentDispatcher.current.useOptimistic(passthrough, reducer);
};
exports.forwardRef = function (render) {
return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
Expand Down Expand Up @@ -648,7 +645,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-canary-388686f29-20230503";
exports.version = "18.3.0-canary-b7972822b-20230503";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
388686f291afb2362fdc813c49f75b4132bc1314
b7972822b5887d05ae772ef757a453265b4b7aec

0 comments on commit 4adb0ac

Please sign in to comment.