Skip to content

Commit 552b724

Browse files
acdliteUmeshmalik
authored andcommitted
Remove prefix from formState option (facebook#27460)
`useFormState` is now in canary.
1 parent bfefb22 commit 552b724

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

fixtures/flight/server/global.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ app.all('/', async function (req, res, next) {
173173
res.set('Content-type', 'text/html');
174174
const {pipe} = renderToPipeableStream(React.createElement(Root), {
175175
bootstrapScripts: mainJSChunks,
176-
experimental_formState: lazyFormState,
176+
formState: lazyFormState,
177177
});
178178
pipe(res);
179179
} catch (e) {

fixtures/flight/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async function hydrateApp() {
4848
// the state needs to be transported as part of the HTML stream. We intend
4949
// to add a feature to Fizz for this, but for now it's up to the
5050
// metaframework to implement correctly.
51-
experimental_formState: formState,
51+
formState: formState,
5252
});
5353
}
5454

packages/react-dom/src/client/ReactDOMRoot.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export type HydrateRootOptions = {
5757
unstable_transitionCallbacks?: TransitionTracingCallbacks,
5858
identifierPrefix?: string,
5959
onRecoverableError?: (error: mixed) => void,
60-
experimental_formState?: ReactFormState<any, any> | null,
60+
formState?: ReactFormState<any, any> | null,
6161
...
6262
};
6363

@@ -326,8 +326,8 @@ export function hydrateRoot(
326326
transitionCallbacks = options.unstable_transitionCallbacks;
327327
}
328328
if (enableAsyncActions && enableFormActions) {
329-
if (options.experimental_formState !== undefined) {
330-
formState = options.experimental_formState;
329+
if (options.formState !== undefined) {
330+
formState = options.formState;
331331
}
332332
}
333333
}

packages/react-dom/src/server/ReactDOMFizzServerBrowser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type Options = {
4343
onPostpone?: (reason: string) => void,
4444
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
4545
importMap?: ImportMap,
46-
experimental_formState?: ReactFormState<any, any> | null,
46+
formState?: ReactFormState<any, any> | null,
4747
};
4848

4949
type ResumeOptions = {
@@ -121,7 +121,7 @@ function renderToReadableStream(
121121
onShellError,
122122
onFatalError,
123123
options ? options.onPostpone : undefined,
124-
options ? options.experimental_formState : undefined,
124+
options ? options.formState : undefined,
125125
);
126126
if (options && options.signal) {
127127
const signal = options.signal;

packages/react-dom/src/server/ReactDOMFizzServerBun.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type Options = {
4040
onPostpone?: (reason: string) => void,
4141
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
4242
importMap?: ImportMap,
43-
experimental_formState?: ReactFormState<any, any> | null,
43+
formState?: ReactFormState<any, any> | null,
4444
};
4545

4646
// TODO: Move to sub-classing ReadableStream.
@@ -111,7 +111,7 @@ function renderToReadableStream(
111111
onShellError,
112112
onFatalError,
113113
options ? options.onPostpone : undefined,
114-
options ? options.experimental_formState : undefined,
114+
options ? options.formState : undefined,
115115
);
116116
if (options && options.signal) {
117117
const signal = options.signal;

packages/react-dom/src/server/ReactDOMFizzServerEdge.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type Options = {
4343
onPostpone?: (reason: string) => void,
4444
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
4545
importMap?: ImportMap,
46-
experimental_formState?: ReactFormState<any, any> | null,
46+
formState?: ReactFormState<any, any> | null,
4747
};
4848

4949
type ResumeOptions = {
@@ -121,7 +121,7 @@ function renderToReadableStream(
121121
onShellError,
122122
onFatalError,
123123
options ? options.onPostpone : undefined,
124-
options ? options.experimental_formState : undefined,
124+
options ? options.formState : undefined,
125125
);
126126
if (options && options.signal) {
127127
const signal = options.signal;

packages/react-dom/src/server/ReactDOMFizzServerNode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ type Options = {
5959
onPostpone?: (reason: string) => void,
6060
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
6161
importMap?: ImportMap,
62-
experimental_formState?: ReactFormState<any, any> | null,
62+
formState?: ReactFormState<any, any> | null,
6363
};
6464

6565
type ResumeOptions = {
@@ -103,7 +103,7 @@ function createRequestImpl(children: ReactNodeList, options: void | Options) {
103103
options ? options.onShellError : undefined,
104104
undefined,
105105
options ? options.onPostpone : undefined,
106-
options ? options.experimental_formState : undefined,
106+
options ? options.formState : undefined,
107107
);
108108
}
109109

packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMForm-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ describe('ReactFlightDOMForm', () => {
454454
);
455455
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
456456
postbackResponse,
457-
{experimental_formState: formState},
457+
{formState: formState},
458458
);
459459
await readIntoContainer(postbackSsrStream);
460460

@@ -468,7 +468,7 @@ describe('ReactFlightDOMForm', () => {
468468
// also does. Remove dev condition once FlightServer.act() is available.
469469
await act(() => {
470470
ReactDOMClient.hydrateRoot(container, postbackResponse, {
471-
experimental_formState: formState,
471+
formState: formState,
472472
});
473473
});
474474
expect(container.textContent).toBe('121');
@@ -552,7 +552,7 @@ describe('ReactFlightDOMForm', () => {
552552
);
553553
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
554554
postbackResponse,
555-
{experimental_formState: formState},
555+
{formState: formState},
556556
);
557557
await readIntoContainer(postbackSsrStream);
558558

@@ -584,7 +584,7 @@ describe('ReactFlightDOMForm', () => {
584584
);
585585
const postbackSsrStream2 = await ReactDOMServer.renderToReadableStream(
586586
postbackResponse2,
587-
{experimental_formState: formState2},
587+
{formState: formState2},
588588
);
589589
await readIntoContainer(postbackSsrStream2);
590590

@@ -668,7 +668,7 @@ describe('ReactFlightDOMForm', () => {
668668
);
669669
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
670670
postbackResponse,
671-
{experimental_formState: formState},
671+
{formState: formState},
672672
);
673673
await readIntoContainer(postbackSsrStream);
674674

@@ -744,7 +744,7 @@ describe('ReactFlightDOMForm', () => {
744744
);
745745
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
746746
postbackResponse,
747-
{experimental_formState: formState},
747+
{formState: formState},
748748
);
749749
await readIntoContainer(postbackSsrStream);
750750

@@ -772,7 +772,7 @@ describe('ReactFlightDOMForm', () => {
772772
);
773773
const postbackSsrStream2 = await ReactDOMServer.renderToReadableStream(
774774
postbackResponse2,
775-
{experimental_formState: formState2},
775+
{formState: formState2},
776776
);
777777
await readIntoContainer(postbackSsrStream2);
778778

0 commit comments

Comments
 (0)