Remove prefix from `formState` option (#27460)
`useFormState` is now in canary.
Andrew Clark committed
Oct 4, 2023 at 15:17 UTC
44d40a077ae91bbf5e18a95b90d8a15c2ec978ca
8 files changed
+20
-20
fixtures/flight/server/global.js
+1
-1
@@ -173,7 +173,7 @@ app.all('/', async function (req, res, next) {
173
res.set('Content-type', 'text/html');
174
const {pipe} = renderToPipeableStream(React.createElement(Root), {
175
bootstrapScripts: mainJSChunks,
176
- experimental_formState: lazyFormState,
176
+ formState: lazyFormState,
177
});
178
pipe(res);
179
} catch (e) {
fixtures/flight/src/index.js
+1
-1
@@ -48,7 +48,7 @@ async function hydrateApp() {
48
// the state needs to be transported as part of the HTML stream. We intend
49
// to add a feature to Fizz for this, but for now it's up to the
50
// metaframework to implement correctly.
51
- experimental_formState: formState,
51
+ formState: formState,
52
});
53
}
54
packages/react-dom/src/client/ReactDOMRoot.js
+3
-3
@@ -57,7 +57,7 @@ export type HydrateRootOptions = {
57
unstable_transitionCallbacks?: TransitionTracingCallbacks,
58
identifierPrefix?: string,
59
onRecoverableError?: (error: mixed) => void,
60
- experimental_formState?: ReactFormState<any, any> | null,
60
+ formState?: ReactFormState<any, any> | null,
61
...
62
};
63
@@ -326,8 +326,8 @@ export function hydrateRoot(
326
transitionCallbacks = options.unstable_transitionCallbacks;
327
}
328
if (enableAsyncActions && enableFormActions) {
329
- if (options.experimental_formState !== undefined) {
330
- formState = options.experimental_formState;
329
+ if (options.formState !== undefined) {
330
+ formState = options.formState;
331
}
332
}
333
}
packages/react-dom/src/server/ReactDOMFizzServerBrowser.js
+2
-2
@@ -43,7 +43,7 @@ type Options = {
43
onPostpone?: (reason: string) => void,
44
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
45
importMap?: ImportMap,
46
- experimental_formState?: ReactFormState<any, any> | null,
46
+ formState?: ReactFormState<any, any> | null,
47
};
48
49
type ResumeOptions = {
@@ -121,7 +121,7 @@ function renderToReadableStream(
121
onShellError,
122
onFatalError,
123
options ? options.onPostpone : undefined,
124
- options ? options.experimental_formState : undefined,
124
+ options ? options.formState : undefined,
125
);
126
if (options && options.signal) {
127
const signal = options.signal;
packages/react-dom/src/server/ReactDOMFizzServerBun.js
+2
-2
@@ -40,7 +40,7 @@ type Options = {
40
onPostpone?: (reason: string) => void,
41
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
42
importMap?: ImportMap,
43
- experimental_formState?: ReactFormState<any, any> | null,
43
+ formState?: ReactFormState<any, any> | null,
44
};
45
46
// TODO: Move to sub-classing ReadableStream.
@@ -111,7 +111,7 @@ function renderToReadableStream(
111
onShellError,
112
onFatalError,
113
options ? options.onPostpone : undefined,
114
- options ? options.experimental_formState : undefined,
114
+ options ? options.formState : undefined,
115
);
116
if (options && options.signal) {
117
const signal = options.signal;
packages/react-dom/src/server/ReactDOMFizzServerEdge.js
+2
-2
@@ -43,7 +43,7 @@ type Options = {
43
onPostpone?: (reason: string) => void,
44
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
45
importMap?: ImportMap,
46
- experimental_formState?: ReactFormState<any, any> | null,
46
+ formState?: ReactFormState<any, any> | null,
47
};
48
49
type ResumeOptions = {
@@ -121,7 +121,7 @@ function renderToReadableStream(
121
onShellError,
122
onFatalError,
123
options ? options.onPostpone : undefined,
124
- options ? options.experimental_formState : undefined,
124
+ options ? options.formState : undefined,
125
);
126
if (options && options.signal) {
127
const signal = options.signal;
packages/react-dom/src/server/ReactDOMFizzServerNode.js
+2
-2
@@ -59,7 +59,7 @@ type Options = {
59
onPostpone?: (reason: string) => void,
60
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
61
importMap?: ImportMap,
62
- experimental_formState?: ReactFormState<any, any> | null,
62
+ formState?: ReactFormState<any, any> | null,
63
};
64
65
type ResumeOptions = {
@@ -103,7 +103,7 @@ function createRequestImpl(children: ReactNodeList, options: void | Options) {
103
options ? options.onShellError : undefined,
104
undefined,
105
options ? options.onPostpone : undefined,
106
- options ? options.experimental_formState : undefined,
106
+ options ? options.formState : undefined,
107
);
108
}
109
packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMForm-test.js
+7
-7
@@ -454,7 +454,7 @@ describe('ReactFlightDOMForm', () => {
454
);
455
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
456
postbackResponse,
457
- {experimental_formState: formState},
457
+ {formState: formState},
458
);
459
await readIntoContainer(postbackSsrStream);
460
@@ -468,7 +468,7 @@ describe('ReactFlightDOMForm', () => {
468
// also does. Remove dev condition once FlightServer.act() is available.
469
await act(() => {
470
ReactDOMClient.hydrateRoot(container, postbackResponse, {
471
- experimental_formState: formState,
471
+ formState: formState,
472
});
473
});
474
expect(container.textContent).toBe('121');
@@ -552,7 +552,7 @@ describe('ReactFlightDOMForm', () => {
552
);
553
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
554
postbackResponse,
555
- {experimental_formState: formState},
555
+ {formState: formState},
556
);
557
await readIntoContainer(postbackSsrStream);
558
@@ -584,7 +584,7 @@ describe('ReactFlightDOMForm', () => {
584
);
585
const postbackSsrStream2 = await ReactDOMServer.renderToReadableStream(
586
postbackResponse2,
587
- {experimental_formState: formState2},
587
+ {formState: formState2},
588
);
589
await readIntoContainer(postbackSsrStream2);
590
@@ -668,7 +668,7 @@ describe('ReactFlightDOMForm', () => {
668
);
669
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
670
postbackResponse,
671
- {experimental_formState: formState},
671
+ {formState: formState},
672
);
673
await readIntoContainer(postbackSsrStream);
674
@@ -744,7 +744,7 @@ describe('ReactFlightDOMForm', () => {
744
);
745
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
746
postbackResponse,
747
- {experimental_formState: formState},
747
+ {formState: formState},
748
);
749
await readIntoContainer(postbackSsrStream);
750
@@ -772,7 +772,7 @@ describe('ReactFlightDOMForm', () => {
772
);
773
const postbackSsrStream2 = await ReactDOMServer.renderToReadableStream(
774
postbackResponse2,
775
- {experimental_formState: formState2},
775
+ {formState: formState2},
776
);
777
await readIntoContainer(postbackSsrStream2);
778