Skip to content

Commit fc94889

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 [18812b6](18812b6)
1 parent aa4213f commit fc94889

10 files changed

+194
-9
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19c7c2929be68f87cfa6b7947c4ab9ffc5608e48
1+
18812b645c93a9c42f931fae57bbbab9c1f402b8

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-classic-b7bec335";
69+
var ReactVersion = "19.0.0-www-classic-9a163259";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -8988,11 +8988,13 @@ if (__DEV__) {
89888988
var didWarnUncachedGetSnapshot;
89898989
var didWarnAboutUseWrappedInTryCatch;
89908990
var didWarnAboutAsyncClientComponent;
8991+
var didWarnAboutUseFormState;
89918992

89928993
{
89938994
didWarnAboutMismatchedHooksForComponent = new Set();
89948995
didWarnAboutUseWrappedInTryCatch = new Set();
89958996
didWarnAboutAsyncClientComponent = new Set();
8997+
didWarnAboutUseFormState = new Set();
89968998
} // The effect "instance" is a shared object that remains the same for the entire
89978999
// lifetime of an effect. In Rust terms, a RefCell. We use it to store the
89989000
// "destroy" function that is returned from an effect, because that is stateful.
@@ -9135,6 +9137,24 @@ if (__DEV__) {
91359137
}
91369138
}
91379139

9140+
function warnOnUseFormStateInDev() {
9141+
{
9142+
var componentName = getComponentNameFromFiber(
9143+
currentlyRenderingFiber$1
9144+
);
9145+
9146+
if (!didWarnAboutUseFormState.has(componentName)) {
9147+
didWarnAboutUseFormState.add(componentName);
9148+
9149+
error(
9150+
"ReactDOM.useFormState has been deprecated and replaced by " +
9151+
"React.useActionState. Please update %s to use React.useActionState.",
9152+
componentName
9153+
);
9154+
}
9155+
}
9156+
}
9157+
91389158
function warnIfAsyncClientComponent(Component) {
91399159
{
91409160
// This dev-only check only works for detecting native async functions,
@@ -12224,6 +12244,7 @@ if (__DEV__) {
1222412244
function useFormState(action, initialState, permalink) {
1222512245
currentHookNameInDev = "useFormState";
1222612246
updateHookTypesDev();
12247+
warnOnUseFormStateInDev();
1222712248
return mountActionState(action, initialState);
1222812249
};
1222912250

@@ -12388,6 +12409,7 @@ if (__DEV__) {
1238812409
) {
1238912410
currentHookNameInDev = "useFormState";
1239012411
updateHookTypesDev();
12412+
warnOnUseFormStateInDev();
1239112413
return updateActionState(action);
1239212414
};
1239312415

@@ -12557,6 +12579,7 @@ if (__DEV__) {
1255712579
) {
1255812580
currentHookNameInDev = "useFormState";
1255912581
updateHookTypesDev();
12582+
warnOnUseFormStateInDev();
1256012583
return rerenderActionState(action);
1256112584
};
1256212585

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-modern-210281fd";
69+
var ReactVersion = "19.0.0-www-modern-58f8023b";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -8753,11 +8753,13 @@ if (__DEV__) {
87538753
var didWarnUncachedGetSnapshot;
87548754
var didWarnAboutUseWrappedInTryCatch;
87558755
var didWarnAboutAsyncClientComponent;
8756+
var didWarnAboutUseFormState;
87568757

87578758
{
87588759
didWarnAboutMismatchedHooksForComponent = new Set();
87598760
didWarnAboutUseWrappedInTryCatch = new Set();
87608761
didWarnAboutAsyncClientComponent = new Set();
8762+
didWarnAboutUseFormState = new Set();
87618763
} // The effect "instance" is a shared object that remains the same for the entire
87628764
// lifetime of an effect. In Rust terms, a RefCell. We use it to store the
87638765
// "destroy" function that is returned from an effect, because that is stateful.
@@ -8900,6 +8902,24 @@ if (__DEV__) {
89008902
}
89018903
}
89028904

8905+
function warnOnUseFormStateInDev() {
8906+
{
8907+
var componentName = getComponentNameFromFiber(
8908+
currentlyRenderingFiber$1
8909+
);
8910+
8911+
if (!didWarnAboutUseFormState.has(componentName)) {
8912+
didWarnAboutUseFormState.add(componentName);
8913+
8914+
error(
8915+
"ReactDOM.useFormState has been deprecated and replaced by " +
8916+
"React.useActionState. Please update %s to use React.useActionState.",
8917+
componentName
8918+
);
8919+
}
8920+
}
8921+
}
8922+
89038923
function warnIfAsyncClientComponent(Component) {
89048924
{
89058925
// This dev-only check only works for detecting native async functions,
@@ -11989,6 +12009,7 @@ if (__DEV__) {
1198912009
function useFormState(action, initialState, permalink) {
1199012010
currentHookNameInDev = "useFormState";
1199112011
updateHookTypesDev();
12012+
warnOnUseFormStateInDev();
1199212013
return mountActionState(action, initialState);
1199312014
};
1199412015

@@ -12153,6 +12174,7 @@ if (__DEV__) {
1215312174
) {
1215412175
currentHookNameInDev = "useFormState";
1215512176
updateHookTypesDev();
12177+
warnOnUseFormStateInDev();
1215612178
return updateActionState(action);
1215712179
};
1215812180

@@ -12322,6 +12344,7 @@ if (__DEV__) {
1232212344
) {
1232312345
currentHookNameInDev = "useFormState";
1232412346
updateHookTypesDev();
12347+
warnOnUseFormStateInDev();
1232512348
return rerenderActionState(action);
1232612349
};
1232712350

compiled/facebook-www/ReactDOM-dev.classic.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13547,11 +13547,13 @@ if (__DEV__) {
1354713547
var didWarnUncachedGetSnapshot;
1354813548
var didWarnAboutUseWrappedInTryCatch;
1354913549
var didWarnAboutAsyncClientComponent;
13550+
var didWarnAboutUseFormState;
1355013551

1355113552
{
1355213553
didWarnAboutMismatchedHooksForComponent = new Set();
1355313554
didWarnAboutUseWrappedInTryCatch = new Set();
1355413555
didWarnAboutAsyncClientComponent = new Set();
13556+
didWarnAboutUseFormState = new Set();
1355513557
} // The effect "instance" is a shared object that remains the same for the entire
1355613558
// lifetime of an effect. In Rust terms, a RefCell. We use it to store the
1355713559
// "destroy" function that is returned from an effect, because that is stateful.
@@ -13696,6 +13698,24 @@ if (__DEV__) {
1369613698
}
1369713699
}
1369813700

13701+
function warnOnUseFormStateInDev() {
13702+
{
13703+
var componentName = getComponentNameFromFiber(
13704+
currentlyRenderingFiber$1
13705+
);
13706+
13707+
if (!didWarnAboutUseFormState.has(componentName)) {
13708+
didWarnAboutUseFormState.add(componentName);
13709+
13710+
error(
13711+
"ReactDOM.useFormState has been deprecated and replaced by " +
13712+
"React.useActionState. Please update %s to use React.useActionState.",
13713+
componentName
13714+
);
13715+
}
13716+
}
13717+
}
13718+
1369913719
function warnIfAsyncClientComponent(Component) {
1370013720
{
1370113721
// This dev-only check only works for detecting native async functions,
@@ -16924,6 +16944,7 @@ if (__DEV__) {
1692416944
function useFormState(action, initialState, permalink) {
1692516945
currentHookNameInDev = "useFormState";
1692616946
updateHookTypesDev();
16947+
warnOnUseFormStateInDev();
1692716948
return mountActionState(action, initialState);
1692816949
};
1692916950

@@ -17092,6 +17113,7 @@ if (__DEV__) {
1709217113
) {
1709317114
currentHookNameInDev = "useFormState";
1709417115
updateHookTypesDev();
17116+
warnOnUseFormStateInDev();
1709517117
return updateActionState(action);
1709617118
};
1709717119

@@ -17265,6 +17287,7 @@ if (__DEV__) {
1726517287
) {
1726617288
currentHookNameInDev = "useFormState";
1726717289
updateHookTypesDev();
17290+
warnOnUseFormStateInDev();
1726817291
return rerenderActionState(action);
1726917292
};
1727017293

@@ -36345,7 +36368,7 @@ if (__DEV__) {
3634536368
return root;
3634636369
}
3634736370

36348-
var ReactVersion = "19.0.0-www-classic-698b36f3";
36371+
var ReactVersion = "19.0.0-www-classic-eb2e3f4c";
3634936372

3635036373
function createPortal$1(
3635136374
children,

compiled/facebook-www/ReactDOM-dev.modern.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13510,11 +13510,13 @@ if (__DEV__) {
1351013510
var didWarnUncachedGetSnapshot;
1351113511
var didWarnAboutUseWrappedInTryCatch;
1351213512
var didWarnAboutAsyncClientComponent;
13513+
var didWarnAboutUseFormState;
1351313514

1351413515
{
1351513516
didWarnAboutMismatchedHooksForComponent = new Set();
1351613517
didWarnAboutUseWrappedInTryCatch = new Set();
1351713518
didWarnAboutAsyncClientComponent = new Set();
13519+
didWarnAboutUseFormState = new Set();
1351813520
} // The effect "instance" is a shared object that remains the same for the entire
1351913521
// lifetime of an effect. In Rust terms, a RefCell. We use it to store the
1352013522
// "destroy" function that is returned from an effect, because that is stateful.
@@ -13659,6 +13661,24 @@ if (__DEV__) {
1365913661
}
1366013662
}
1366113663

13664+
function warnOnUseFormStateInDev() {
13665+
{
13666+
var componentName = getComponentNameFromFiber(
13667+
currentlyRenderingFiber$1
13668+
);
13669+
13670+
if (!didWarnAboutUseFormState.has(componentName)) {
13671+
didWarnAboutUseFormState.add(componentName);
13672+
13673+
error(
13674+
"ReactDOM.useFormState has been deprecated and replaced by " +
13675+
"React.useActionState. Please update %s to use React.useActionState.",
13676+
componentName
13677+
);
13678+
}
13679+
}
13680+
}
13681+
1366213682
function warnIfAsyncClientComponent(Component) {
1366313683
{
1366413684
// This dev-only check only works for detecting native async functions,
@@ -16887,6 +16907,7 @@ if (__DEV__) {
1688716907
function useFormState(action, initialState, permalink) {
1688816908
currentHookNameInDev = "useFormState";
1688916909
updateHookTypesDev();
16910+
warnOnUseFormStateInDev();
1689016911
return mountActionState(action, initialState);
1689116912
};
1689216913

@@ -17055,6 +17076,7 @@ if (__DEV__) {
1705517076
) {
1705617077
currentHookNameInDev = "useFormState";
1705717078
updateHookTypesDev();
17079+
warnOnUseFormStateInDev();
1705817080
return updateActionState(action);
1705917081
};
1706017082

@@ -17228,6 +17250,7 @@ if (__DEV__) {
1722817250
) {
1722917251
currentHookNameInDev = "useFormState";
1723017252
updateHookTypesDev();
17253+
warnOnUseFormStateInDev();
1723117254
return rerenderActionState(action);
1723217255
};
1723317256

@@ -36193,7 +36216,7 @@ if (__DEV__) {
3619336216
return root;
3619436217
}
3619536218

36196-
var ReactVersion = "19.0.0-www-modern-05455d88";
36219+
var ReactVersion = "19.0.0-www-modern-0c956171";
3619736220

3619836221
function createPortal$1(
3619936222
children,

compiled/facebook-www/ReactDOMTesting-dev.classic.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13684,11 +13684,13 @@ if (__DEV__) {
1368413684
var didWarnUncachedGetSnapshot;
1368513685
var didWarnAboutUseWrappedInTryCatch;
1368613686
var didWarnAboutAsyncClientComponent;
13687+
var didWarnAboutUseFormState;
1368713688

1368813689
{
1368913690
didWarnAboutMismatchedHooksForComponent = new Set();
1369013691
didWarnAboutUseWrappedInTryCatch = new Set();
1369113692
didWarnAboutAsyncClientComponent = new Set();
13693+
didWarnAboutUseFormState = new Set();
1369213694
} // The effect "instance" is a shared object that remains the same for the entire
1369313695
// lifetime of an effect. In Rust terms, a RefCell. We use it to store the
1369413696
// "destroy" function that is returned from an effect, because that is stateful.
@@ -13833,6 +13835,24 @@ if (__DEV__) {
1383313835
}
1383413836
}
1383513837

13838+
function warnOnUseFormStateInDev() {
13839+
{
13840+
var componentName = getComponentNameFromFiber(
13841+
currentlyRenderingFiber$1
13842+
);
13843+
13844+
if (!didWarnAboutUseFormState.has(componentName)) {
13845+
didWarnAboutUseFormState.add(componentName);
13846+
13847+
error(
13848+
"ReactDOM.useFormState has been deprecated and replaced by " +
13849+
"React.useActionState. Please update %s to use React.useActionState.",
13850+
componentName
13851+
);
13852+
}
13853+
}
13854+
}
13855+
1383613856
function warnIfAsyncClientComponent(Component) {
1383713857
{
1383813858
// This dev-only check only works for detecting native async functions,
@@ -17061,6 +17081,7 @@ if (__DEV__) {
1706117081
function useFormState(action, initialState, permalink) {
1706217082
currentHookNameInDev = "useFormState";
1706317083
updateHookTypesDev();
17084+
warnOnUseFormStateInDev();
1706417085
return mountActionState(action, initialState);
1706517086
};
1706617087

@@ -17229,6 +17250,7 @@ if (__DEV__) {
1722917250
) {
1723017251
currentHookNameInDev = "useFormState";
1723117252
updateHookTypesDev();
17253+
warnOnUseFormStateInDev();
1723217254
return updateActionState(action);
1723317255
};
1723417256

@@ -17402,6 +17424,7 @@ if (__DEV__) {
1740217424
) {
1740317425
currentHookNameInDev = "useFormState";
1740417426
updateHookTypesDev();
17427+
warnOnUseFormStateInDev();
1740517428
return rerenderActionState(action);
1740617429
};
1740717430

@@ -36969,7 +36992,7 @@ if (__DEV__) {
3696936992
return root;
3697036993
}
3697136994

36972-
var ReactVersion = "19.0.0-www-classic-f4cfd755";
36995+
var ReactVersion = "19.0.0-www-classic-25663c8c";
3697336996

3697436997
function createPortal$1(
3697536998
children,

0 commit comments

Comments
 (0)