Skip to content

Commit f477752

Browse files
committed
Warn when using useFormState (#28668)
## Overview useFormState has been replaced with useActionState. Warn when it's used. Also removes the `experimental_useFormState` warnings. DiffTrain build for commit 18812b6.
1 parent d777384 commit f477752

File tree

4 files changed

+76
-7
lines changed

4 files changed

+76
-7
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

+25-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<2123de3808a6ddc6df79e3bd382b5c8a>>
10+
* @generated SignedSource<<bcb9ae48fd24d391c11eab7a159bcc36>>
1111
*/
1212

1313
"use strict";
@@ -7631,11 +7631,13 @@ if (__DEV__) {
76317631
var didWarnUncachedGetSnapshot;
76327632
var didWarnAboutUseWrappedInTryCatch;
76337633
var didWarnAboutAsyncClientComponent;
7634+
var didWarnAboutUseFormState;
76347635

76357636
{
76367637
didWarnAboutMismatchedHooksForComponent = new Set();
76377638
didWarnAboutUseWrappedInTryCatch = new Set();
76387639
didWarnAboutAsyncClientComponent = new Set();
7640+
didWarnAboutUseFormState = new Set();
76397641
} // The effect "instance" is a shared object that remains the same for the entire
76407642
// lifetime of an effect. In Rust terms, a RefCell. We use it to store the
76417643
// "destroy" function that is returned from an effect, because that is stateful.
@@ -7778,6 +7780,24 @@ if (__DEV__) {
77787780
}
77797781
}
77807782

7783+
function warnOnUseFormStateInDev() {
7784+
{
7785+
var componentName = getComponentNameFromFiber(
7786+
currentlyRenderingFiber$1
7787+
);
7788+
7789+
if (!didWarnAboutUseFormState.has(componentName)) {
7790+
didWarnAboutUseFormState.add(componentName);
7791+
7792+
error(
7793+
"ReactDOM.useFormState has been deprecated and replaced by " +
7794+
"React.useActionState. Please update %s to use React.useActionState.",
7795+
componentName
7796+
);
7797+
}
7798+
}
7799+
}
7800+
77817801
function warnIfAsyncClientComponent(Component) {
77827802
{
77837803
// This dev-only check only works for detecting native async functions,
@@ -10626,6 +10646,7 @@ if (__DEV__) {
1062610646
function useFormState(action, initialState, permalink) {
1062710647
currentHookNameInDev = "useFormState";
1062810648
updateHookTypesDev();
10649+
warnOnUseFormStateInDev();
1062910650
return mountActionState(action, initialState);
1063010651
};
1063110652

@@ -10780,6 +10801,7 @@ if (__DEV__) {
1078010801
) {
1078110802
currentHookNameInDev = "useFormState";
1078210803
updateHookTypesDev();
10804+
warnOnUseFormStateInDev();
1078310805
return updateActionState(action);
1078410806
};
1078510807

@@ -10939,6 +10961,7 @@ if (__DEV__) {
1093910961
) {
1094010962
currentHookNameInDev = "useFormState";
1094110963
updateHookTypesDev();
10964+
warnOnUseFormStateInDev();
1094210965
return rerenderActionState(action);
1094310966
};
1094410967

@@ -26249,7 +26272,7 @@ if (__DEV__) {
2624926272
return root;
2625026273
}
2625126274

26252-
var ReactVersion = "19.0.0-canary-5cab92f5";
26275+
var ReactVersion = "19.0.0-canary-bf3f1a01";
2625326276

2625426277
// Might add PROFILE later.
2625526278

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a73c3450e1b528fa6cb3e94fa4d4359c7a4b61f1
1+
18812b645c93a9c42f931fae57bbbab9c1f402b8

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js

+25-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<359ce6fb063e371084bf38d1957253bd>>
10+
* @generated SignedSource<<dbb809a434e7b6781bf5289b294a7b12>>
1111
*/
1212

1313
"use strict";
@@ -11435,11 +11435,13 @@ to return true:wantsResponderID| |
1143511435
var didWarnUncachedGetSnapshot;
1143611436
var didWarnAboutUseWrappedInTryCatch;
1143711437
var didWarnAboutAsyncClientComponent;
11438+
var didWarnAboutUseFormState;
1143811439

1143911440
{
1144011441
didWarnAboutMismatchedHooksForComponent = new Set();
1144111442
didWarnAboutUseWrappedInTryCatch = new Set();
1144211443
didWarnAboutAsyncClientComponent = new Set();
11444+
didWarnAboutUseFormState = new Set();
1144311445
} // The effect "instance" is a shared object that remains the same for the entire
1144411446
// lifetime of an effect. In Rust terms, a RefCell. We use it to store the
1144511447
// "destroy" function that is returned from an effect, because that is stateful.
@@ -11582,6 +11584,24 @@ to return true:wantsResponderID| |
1158211584
}
1158311585
}
1158411586

11587+
function warnOnUseFormStateInDev() {
11588+
{
11589+
var componentName = getComponentNameFromFiber(
11590+
currentlyRenderingFiber$1
11591+
);
11592+
11593+
if (!didWarnAboutUseFormState.has(componentName)) {
11594+
didWarnAboutUseFormState.add(componentName);
11595+
11596+
error(
11597+
"ReactDOM.useFormState has been deprecated and replaced by " +
11598+
"React.useActionState. Please update %s to use React.useActionState.",
11599+
componentName
11600+
);
11601+
}
11602+
}
11603+
}
11604+
1158511605
function warnIfAsyncClientComponent(Component) {
1158611606
{
1158711607
// This dev-only check only works for detecting native async functions,
@@ -14580,6 +14600,7 @@ to return true:wantsResponderID| |
1458014600
function useFormState(action, initialState, permalink) {
1458114601
currentHookNameInDev = "useFormState";
1458214602
updateHookTypesDev();
14603+
warnOnUseFormStateInDev();
1458314604
return mountActionState(action, initialState);
1458414605
};
1458514606

@@ -14734,6 +14755,7 @@ to return true:wantsResponderID| |
1473414755
) {
1473514756
currentHookNameInDev = "useFormState";
1473614757
updateHookTypesDev();
14758+
warnOnUseFormStateInDev();
1473714759
return updateActionState(action);
1473814760
};
1473914761

@@ -14893,6 +14915,7 @@ to return true:wantsResponderID| |
1489314915
) {
1489414916
currentHookNameInDev = "useFormState";
1489514917
updateHookTypesDev();
14918+
warnOnUseFormStateInDev();
1489614919
return rerenderActionState(action);
1489714920
};
1489814921

@@ -30580,7 +30603,7 @@ to return true:wantsResponderID| |
3058030603
return root;
3058130604
}
3058230605

30583-
var ReactVersion = "19.0.0-canary-7938b6a8";
30606+
var ReactVersion = "19.0.0-canary-c6651440";
3058430607

3058530608
function createPortal$1(
3058630609
children,

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js

+25-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<a9d8887935e3fc32f3bf95aea2bbf91d>>
10+
* @generated SignedSource<<cf66f3f917e3c7a41bc8a26d1175d766>>
1111
*/
1212

1313
"use strict";
@@ -11706,11 +11706,13 @@ to return true:wantsResponderID| |
1170611706
var didWarnUncachedGetSnapshot;
1170711707
var didWarnAboutUseWrappedInTryCatch;
1170811708
var didWarnAboutAsyncClientComponent;
11709+
var didWarnAboutUseFormState;
1170911710

1171011711
{
1171111712
didWarnAboutMismatchedHooksForComponent = new Set();
1171211713
didWarnAboutUseWrappedInTryCatch = new Set();
1171311714
didWarnAboutAsyncClientComponent = new Set();
11715+
didWarnAboutUseFormState = new Set();
1171411716
} // The effect "instance" is a shared object that remains the same for the entire
1171511717
// lifetime of an effect. In Rust terms, a RefCell. We use it to store the
1171611718
// "destroy" function that is returned from an effect, because that is stateful.
@@ -11853,6 +11855,24 @@ to return true:wantsResponderID| |
1185311855
}
1185411856
}
1185511857

11858+
function warnOnUseFormStateInDev() {
11859+
{
11860+
var componentName = getComponentNameFromFiber(
11861+
currentlyRenderingFiber$1
11862+
);
11863+
11864+
if (!didWarnAboutUseFormState.has(componentName)) {
11865+
didWarnAboutUseFormState.add(componentName);
11866+
11867+
error(
11868+
"ReactDOM.useFormState has been deprecated and replaced by " +
11869+
"React.useActionState. Please update %s to use React.useActionState.",
11870+
componentName
11871+
);
11872+
}
11873+
}
11874+
}
11875+
1185611876
function warnIfAsyncClientComponent(Component) {
1185711877
{
1185811878
// This dev-only check only works for detecting native async functions,
@@ -14851,6 +14871,7 @@ to return true:wantsResponderID| |
1485114871
function useFormState(action, initialState, permalink) {
1485214872
currentHookNameInDev = "useFormState";
1485314873
updateHookTypesDev();
14874+
warnOnUseFormStateInDev();
1485414875
return mountActionState(action, initialState);
1485514876
};
1485614877

@@ -15005,6 +15026,7 @@ to return true:wantsResponderID| |
1500515026
) {
1500615027
currentHookNameInDev = "useFormState";
1500715028
updateHookTypesDev();
15029+
warnOnUseFormStateInDev();
1500815030
return updateActionState(action);
1500915031
};
1501015032

@@ -15164,6 +15186,7 @@ to return true:wantsResponderID| |
1516415186
) {
1516515187
currentHookNameInDev = "useFormState";
1516615188
updateHookTypesDev();
15189+
warnOnUseFormStateInDev();
1516715190
return rerenderActionState(action);
1516815191
};
1516915192

@@ -31020,7 +31043,7 @@ to return true:wantsResponderID| |
3102031043
return root;
3102131044
}
3102231045

31023-
var ReactVersion = "19.0.0-canary-ebdc2fa2";
31046+
var ReactVersion = "19.0.0-canary-09379a47";
3102431047

3102531048
function createPortal$1(
3102631049
children,

0 commit comments

Comments
 (0)