mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Remove prefix from formState option (#27460)
`useFormState` is now in canary.
This commit is contained in:
@@ -173,7 +173,7 @@ app.all('/', async function (req, res, next) {
|
||||
res.set('Content-type', 'text/html');
|
||||
const {pipe} = renderToPipeableStream(React.createElement(Root), {
|
||||
bootstrapScripts: mainJSChunks,
|
||||
experimental_formState: lazyFormState,
|
||||
formState: lazyFormState,
|
||||
});
|
||||
pipe(res);
|
||||
} catch (e) {
|
||||
|
||||
@@ -48,7 +48,7 @@ async function hydrateApp() {
|
||||
// the state needs to be transported as part of the HTML stream. We intend
|
||||
// to add a feature to Fizz for this, but for now it's up to the
|
||||
// metaframework to implement correctly.
|
||||
experimental_formState: formState,
|
||||
formState: formState,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ export type HydrateRootOptions = {
|
||||
unstable_transitionCallbacks?: TransitionTracingCallbacks,
|
||||
identifierPrefix?: string,
|
||||
onRecoverableError?: (error: mixed) => void,
|
||||
experimental_formState?: ReactFormState<any, any> | null,
|
||||
formState?: ReactFormState<any, any> | null,
|
||||
...
|
||||
};
|
||||
|
||||
@@ -326,8 +326,8 @@ export function hydrateRoot(
|
||||
transitionCallbacks = options.unstable_transitionCallbacks;
|
||||
}
|
||||
if (enableAsyncActions && enableFormActions) {
|
||||
if (options.experimental_formState !== undefined) {
|
||||
formState = options.experimental_formState;
|
||||
if (options.formState !== undefined) {
|
||||
formState = options.formState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ type Options = {
|
||||
onPostpone?: (reason: string) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
experimental_formState?: ReactFormState<any, any> | null,
|
||||
formState?: ReactFormState<any, any> | null,
|
||||
};
|
||||
|
||||
type ResumeOptions = {
|
||||
@@ -121,7 +121,7 @@ function renderToReadableStream(
|
||||
onShellError,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.experimental_formState : undefined,
|
||||
options ? options.formState : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
@@ -40,7 +40,7 @@ type Options = {
|
||||
onPostpone?: (reason: string) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
experimental_formState?: ReactFormState<any, any> | null,
|
||||
formState?: ReactFormState<any, any> | null,
|
||||
};
|
||||
|
||||
// TODO: Move to sub-classing ReadableStream.
|
||||
@@ -111,7 +111,7 @@ function renderToReadableStream(
|
||||
onShellError,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.experimental_formState : undefined,
|
||||
options ? options.formState : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
@@ -43,7 +43,7 @@ type Options = {
|
||||
onPostpone?: (reason: string) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
experimental_formState?: ReactFormState<any, any> | null,
|
||||
formState?: ReactFormState<any, any> | null,
|
||||
};
|
||||
|
||||
type ResumeOptions = {
|
||||
@@ -121,7 +121,7 @@ function renderToReadableStream(
|
||||
onShellError,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.experimental_formState : undefined,
|
||||
options ? options.formState : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
@@ -59,7 +59,7 @@ type Options = {
|
||||
onPostpone?: (reason: string) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
experimental_formState?: ReactFormState<any, any> | null,
|
||||
formState?: ReactFormState<any, any> | null,
|
||||
};
|
||||
|
||||
type ResumeOptions = {
|
||||
@@ -103,7 +103,7 @@ function createRequestImpl(children: ReactNodeList, options: void | Options) {
|
||||
options ? options.onShellError : undefined,
|
||||
undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.experimental_formState : undefined,
|
||||
options ? options.formState : undefined,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -454,7 +454,7 @@ describe('ReactFlightDOMForm', () => {
|
||||
);
|
||||
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
|
||||
postbackResponse,
|
||||
{experimental_formState: formState},
|
||||
{formState: formState},
|
||||
);
|
||||
await readIntoContainer(postbackSsrStream);
|
||||
|
||||
@@ -468,7 +468,7 @@ describe('ReactFlightDOMForm', () => {
|
||||
// also does. Remove dev condition once FlightServer.act() is available.
|
||||
await act(() => {
|
||||
ReactDOMClient.hydrateRoot(container, postbackResponse, {
|
||||
experimental_formState: formState,
|
||||
formState: formState,
|
||||
});
|
||||
});
|
||||
expect(container.textContent).toBe('121');
|
||||
@@ -552,7 +552,7 @@ describe('ReactFlightDOMForm', () => {
|
||||
);
|
||||
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
|
||||
postbackResponse,
|
||||
{experimental_formState: formState},
|
||||
{formState: formState},
|
||||
);
|
||||
await readIntoContainer(postbackSsrStream);
|
||||
|
||||
@@ -584,7 +584,7 @@ describe('ReactFlightDOMForm', () => {
|
||||
);
|
||||
const postbackSsrStream2 = await ReactDOMServer.renderToReadableStream(
|
||||
postbackResponse2,
|
||||
{experimental_formState: formState2},
|
||||
{formState: formState2},
|
||||
);
|
||||
await readIntoContainer(postbackSsrStream2);
|
||||
|
||||
@@ -668,7 +668,7 @@ describe('ReactFlightDOMForm', () => {
|
||||
);
|
||||
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
|
||||
postbackResponse,
|
||||
{experimental_formState: formState},
|
||||
{formState: formState},
|
||||
);
|
||||
await readIntoContainer(postbackSsrStream);
|
||||
|
||||
@@ -744,7 +744,7 @@ describe('ReactFlightDOMForm', () => {
|
||||
);
|
||||
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
|
||||
postbackResponse,
|
||||
{experimental_formState: formState},
|
||||
{formState: formState},
|
||||
);
|
||||
await readIntoContainer(postbackSsrStream);
|
||||
|
||||
@@ -772,7 +772,7 @@ describe('ReactFlightDOMForm', () => {
|
||||
);
|
||||
const postbackSsrStream2 = await ReactDOMServer.renderToReadableStream(
|
||||
postbackResponse2,
|
||||
{experimental_formState: formState2},
|
||||
{formState: formState2},
|
||||
);
|
||||
await readIntoContainer(postbackSsrStream2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user