Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove prefix from formState option #27460

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fixtures/flight/server/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion fixtures/flight/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}

Expand Down
6 changes: 3 additions & 3 deletions packages/react-dom/src/client/ReactDOMRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
...
};

Expand Down Expand Up @@ -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;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/server/ReactDOMFizzServerBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/server/ReactDOMFizzServerBun.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/server/ReactDOMFizzServerEdge.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/server/ReactDOMFizzServerNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ describe('ReactFlightDOMForm', () => {
);
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
postbackResponse,
{experimental_formState: formState},
{formState: formState},
);
await readIntoContainer(postbackSsrStream);

Expand All @@ -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');
Expand Down Expand Up @@ -552,7 +552,7 @@ describe('ReactFlightDOMForm', () => {
);
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
postbackResponse,
{experimental_formState: formState},
{formState: formState},
);
await readIntoContainer(postbackSsrStream);

Expand Down Expand Up @@ -584,7 +584,7 @@ describe('ReactFlightDOMForm', () => {
);
const postbackSsrStream2 = await ReactDOMServer.renderToReadableStream(
postbackResponse2,
{experimental_formState: formState2},
{formState: formState2},
);
await readIntoContainer(postbackSsrStream2);

Expand Down Expand Up @@ -668,7 +668,7 @@ describe('ReactFlightDOMForm', () => {
);
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
postbackResponse,
{experimental_formState: formState},
{formState: formState},
);
await readIntoContainer(postbackSsrStream);

Expand Down Expand Up @@ -744,7 +744,7 @@ describe('ReactFlightDOMForm', () => {
);
const postbackSsrStream = await ReactDOMServer.renderToReadableStream(
postbackResponse,
{experimental_formState: formState},
{formState: formState},
);
await readIntoContainer(postbackSsrStream);

Expand Down Expand Up @@ -772,7 +772,7 @@ describe('ReactFlightDOMForm', () => {
);
const postbackSsrStream2 = await ReactDOMServer.renderToReadableStream(
postbackResponse2,
{experimental_formState: formState2},
{formState: formState2},
);
await readIntoContainer(postbackSsrStream2);

Expand Down