From 24fa5f4a0c4082ae922f3fd9389d5d808fa4bc8d Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Tue, 18 Jul 2023 18:02:56 -0400 Subject: [PATCH] v2: remove future.v2_normalizeFormMethod --- .changeset/v2-remove-normalize-form-method.md | 9 +++++++++ docs/hooks/use-navigation.md | 2 -- docs/pages/api-development-strategy.md | 15 +++++++-------- integration/action-test.ts | 1 - integration/defer-test.ts | 1 - integration/hmr-log-test.ts | 1 - integration/hmr-test.ts | 1 - integration/navigation-state-test.ts | 5 ----- packages/remix-dev/__tests__/readConfig-test.ts | 2 -- packages/remix-dev/config.ts | 12 ------------ packages/remix-react/browser.tsx | 8 +------- packages/remix-react/entry.ts | 1 - packages/remix-server-runtime/entry.ts | 1 - packages/remix-testing/create-remix-stub.tsx | 1 - templates/arc/remix.config.js | 1 - templates/cloudflare-pages/remix.config.js | 1 - templates/cloudflare-workers/remix.config.js | 1 - templates/deno/remix.config.js | 1 - templates/express/remix.config.js | 1 - templates/fly/remix.config.js | 1 - templates/netlify/remix.config.js | 1 - templates/remix/remix.config.js | 1 - templates/vercel/remix.config.js | 1 - 23 files changed, 17 insertions(+), 52 deletions(-) create mode 100644 .changeset/v2-remove-normalize-form-method.md diff --git a/.changeset/v2-remove-normalize-form-method.md b/.changeset/v2-remove-normalize-form-method.md new file mode 100644 index 00000000000..f15c335dadd --- /dev/null +++ b/.changeset/v2-remove-normalize-form-method.md @@ -0,0 +1,9 @@ +--- +"@remix-run/dev": major +"@remix-run/eslint-config": major +"@remix-run/react": major +"@remix-run/server-runtime": major +"@remix-run/testing": major +--- + +Remove `v2_normalizeFormMethod` future flag - all `formMethod` values will be normalized in v2 diff --git a/docs/hooks/use-navigation.md b/docs/hooks/use-navigation.md index 22f915491b0..07dec23017b 100644 --- a/docs/hooks/use-navigation.md +++ b/docs/hooks/use-navigation.md @@ -20,8 +20,6 @@ function SomeComponent() { } ``` -The `useNavigation().formMethod` field is lowercase without the `future.v2_normalizeFormMethod` [Future Flag][api-development-strategy]. This is being normalized to uppercase to align with the `fetch()` behavior in v2, so please upgrade your Remix v1 applications to adopt the uppercase HTTP methods. - For more information and usage, please refer to the [React Router `useNavigation` docs][rr-usenavigation]. [rr-usenavigation]: https://reactrouter.com/hooks/use-navigation diff --git a/docs/pages/api-development-strategy.md b/docs/pages/api-development-strategy.md index 49820c1d2fa..4ba18fe57c5 100644 --- a/docs/pages/api-development-strategy.md +++ b/docs/pages/api-development-strategy.md @@ -50,14 +50,13 @@ The lifecycle is thus either: ## Current Future Flags -| Flag | Description | -| ------------------------ | --------------------------------------------------------------------- | -| `v2_dev` | Enable the new development server (including HMR/HDR support) | -| `v2_errorBoundary` | Combine `ErrorBoundary`/`CatchBoundary` into a single `ErrorBoundary` | -| `v2_headers` | Leverage ancestor `headers` if children do not export `headers` | -| `v2_meta` | Enable the new API for your `meta` functions | -| `v2_normalizeFormMethod` | Normalize `useNavigation().formMethod` to be an uppercase HTTP Method | -| `v2_routeConvention` | Enable the flat routes style of file-based routing | +| Flag | Description | +| -------------------- | --------------------------------------------------------------------- | +| `v2_dev` | Enable the new development server (including HMR/HDR support) | +| `v2_errorBoundary` | Combine `ErrorBoundary`/`CatchBoundary` into a single `ErrorBoundary` | +| `v2_headers` | Leverage ancestor `headers` if children do not export `headers` | +| `v2_meta` | Enable the new API for your `meta` functions | +| `v2_routeConvention` | Enable the flat routes style of file-based routing | [future-flags-blog-post]: https://remix.run/blog/future-flags [feature-flowchart]: /docs-images/feature-flowchart.png diff --git a/integration/action-test.ts b/integration/action-test.ts index 4154ba7696c..51e57026860 100644 --- a/integration/action-test.ts +++ b/integration/action-test.ts @@ -21,7 +21,6 @@ test.describe("actions", () => { future: { v2_routeConvention: true, v2_errorBoundary: true, - v2_normalizeFormMethod: true, }, }, files: { diff --git a/integration/defer-test.ts b/integration/defer-test.ts index aa49e5da735..9ffd25ab828 100644 --- a/integration/defer-test.ts +++ b/integration/defer-test.ts @@ -46,7 +46,6 @@ test.describe("non-aborted", () => { future: { v2_routeConvention: true, v2_errorBoundary: true, - v2_normalizeFormMethod: true, }, }, files: { diff --git a/integration/hmr-log-test.ts b/integration/hmr-log-test.ts index 6e3d2ffa466..589c2b54ad1 100644 --- a/integration/hmr-log-test.ts +++ b/integration/hmr-log-test.ts @@ -20,7 +20,6 @@ let fixture = (options: { appPort: number; devPort: number }): FixtureInit => ({ }, v2_routeConvention: true, v2_errorBoundary: true, - v2_normalizeFormMethod: true, v2_meta: true, v2_headers: true, }, diff --git a/integration/hmr-test.ts b/integration/hmr-test.ts index f217123e375..b58e7cc037a 100644 --- a/integration/hmr-test.ts +++ b/integration/hmr-test.ts @@ -20,7 +20,6 @@ let fixture = (options: { appPort: number; devPort: number }): FixtureInit => ({ }, v2_routeConvention: true, v2_errorBoundary: true, - v2_normalizeFormMethod: true, v2_meta: true, v2_headers: true, }, diff --git a/integration/navigation-state-test.ts b/integration/navigation-state-test.ts index 9bf19ff603b..319e9b58fea 100644 --- a/integration/navigation-state-test.ts +++ b/integration/navigation-state-test.ts @@ -31,11 +31,6 @@ test.describe("navigation states", () => { test.beforeAll(async () => { fixture = await createFixture({ - config: { - future: { - v2_normalizeFormMethod: true, - }, - }, files: { "app/root.jsx": js` import { useMemo, useRef } from "react"; diff --git a/packages/remix-dev/__tests__/readConfig-test.ts b/packages/remix-dev/__tests__/readConfig-test.ts index fa3a50cd218..efad201b9fc 100644 --- a/packages/remix-dev/__tests__/readConfig-test.ts +++ b/packages/remix-dev/__tests__/readConfig-test.ts @@ -30,7 +30,6 @@ describe("readConfig", () => { v2_errorBoundary: expect.any(Boolean), v2_headers: expect.any(Boolean), v2_meta: expect.any(Boolean), - v2_normalizeFormMethod: expect.any(Boolean), v2_routeConvention: expect.any(Boolean), }, }, @@ -52,7 +51,6 @@ describe("readConfig", () => { "v2_errorBoundary": Any, "v2_headers": Any, "v2_meta": Any, - "v2_normalizeFormMethod": Any, "v2_routeConvention": Any, }, "mdx": undefined, diff --git a/packages/remix-dev/config.ts b/packages/remix-dev/config.ts index 647858e4665..5f96d60b6cd 100644 --- a/packages/remix-dev/config.ts +++ b/packages/remix-dev/config.ts @@ -60,7 +60,6 @@ interface FutureConfig { v2_errorBoundary: boolean; v2_headers: boolean; v2_meta: boolean; - v2_normalizeFormMethod: boolean; v2_routeConvention: boolean; } @@ -450,10 +449,6 @@ export async function readConfig( errorBoundaryWarning(); } - if (!appConfig.future?.v2_normalizeFormMethod) { - formMethodWarning(); - } - if (!appConfig.future?.v2_meta) { metaWarning(); } @@ -820,7 +815,6 @@ export async function readConfig( v2_errorBoundary: appConfig.future?.v2_errorBoundary === true, v2_headers: appConfig.future?.v2_headers === true, v2_meta: appConfig.future?.v2_meta === true, - v2_normalizeFormMethod: appConfig.future?.v2_normalizeFormMethod === true, v2_routeConvention: appConfig.future?.v2_routeConvention === true, }; @@ -1043,12 +1037,6 @@ let errorBoundaryWarning = futureFlagWarning({ link: "https://remix.run/docs/en/v1.15.0/pages/v2#catchboundary-and-errorboundary", }); -let formMethodWarning = futureFlagWarning({ - message: "The `formMethod` API is changing in v2", - flag: "v2_normalizeFormMethod", - link: "https://remix.run/docs/en/v1.15.0/pages/v2#formMethod", -}); - let metaWarning = futureFlagWarning({ message: "The route `meta` API is changing in v2", flag: "v2_meta", diff --git a/packages/remix-react/browser.tsx b/packages/remix-react/browser.tsx index a18bb8850d5..c877d25d180 100644 --- a/packages/remix-react/browser.tsx +++ b/packages/remix-react/browser.tsx @@ -193,13 +193,7 @@ export function RemixBrowser(_props: RemixBrowserProps): ReactElement { router = createBrowserRouter(routes, { hydrationData, future: { - // Pass through the Remix future flag to avoid a v1 breaking change in - // useNavigation() - users can control the casing via the flag in v1. - // useFetcher still always uppercases in the back-compat layer in v1. - // In v2 we can just always pass true here and remove the back-compat - // layer - v7_normalizeFormMethod: - window.__remixContext.future.v2_normalizeFormMethod, + v7_normalizeFormMethod: true, }, }); diff --git a/packages/remix-react/entry.ts b/packages/remix-react/entry.ts index 2462c016fe7..d038c37d7f9 100644 --- a/packages/remix-react/entry.ts +++ b/packages/remix-react/entry.ts @@ -41,7 +41,6 @@ export interface FutureConfig { v2_errorBoundary: boolean; v2_headers: boolean; v2_meta: boolean; - v2_normalizeFormMethod: boolean; v2_routeConvention: boolean; } diff --git a/packages/remix-server-runtime/entry.ts b/packages/remix-server-runtime/entry.ts index b20be17e389..4d23a69bbbc 100644 --- a/packages/remix-server-runtime/entry.ts +++ b/packages/remix-server-runtime/entry.ts @@ -29,7 +29,6 @@ export interface FutureConfig { v2_errorBoundary: boolean; v2_headers: boolean; v2_meta: boolean; - v2_normalizeFormMethod: boolean; v2_routeConvention: boolean; } diff --git a/packages/remix-testing/create-remix-stub.tsx b/packages/remix-testing/create-remix-stub.tsx index 6d4fae6bb25..f4c68124f98 100644 --- a/packages/remix-testing/create-remix-stub.tsx +++ b/packages/remix-testing/create-remix-stub.tsx @@ -130,7 +130,6 @@ export function createRemixStub( v2_errorBoundary: false, v2_headers: false, v2_meta: false, - v2_normalizeFormMethod: false, v2_routeConvention: false, ...remixConfigFuture, }, diff --git a/templates/arc/remix.config.js b/templates/arc/remix.config.js index c0345763aae..6ab9f8eee67 100644 --- a/templates/arc/remix.config.js +++ b/templates/arc/remix.config.js @@ -12,7 +12,6 @@ export default { v2_errorBoundary: true, v2_headers: true, v2_meta: true, - v2_normalizeFormMethod: true, v2_routeConvention: true, }, }; diff --git a/templates/cloudflare-pages/remix.config.js b/templates/cloudflare-pages/remix.config.js index d31efea86fe..8fb267610fd 100644 --- a/templates/cloudflare-pages/remix.config.js +++ b/templates/cloudflare-pages/remix.config.js @@ -18,7 +18,6 @@ export default { v2_errorBoundary: true, v2_headers: true, v2_meta: true, - v2_normalizeFormMethod: true, v2_routeConvention: true, }, }; diff --git a/templates/cloudflare-workers/remix.config.js b/templates/cloudflare-workers/remix.config.js index b971b575863..1887bd531e5 100644 --- a/templates/cloudflare-workers/remix.config.js +++ b/templates/cloudflare-workers/remix.config.js @@ -20,7 +20,6 @@ export default { v2_errorBoundary: true, v2_headers: true, v2_meta: true, - v2_normalizeFormMethod: true, v2_routeConvention: true, }, }; diff --git a/templates/deno/remix.config.js b/templates/deno/remix.config.js index d0c78e97eef..8da899e0c26 100644 --- a/templates/deno/remix.config.js +++ b/templates/deno/remix.config.js @@ -22,7 +22,6 @@ module.exports = { v2_errorBoundary: true, v2_headers: true, v2_meta: true, - v2_normalizeFormMethod: true, v2_routeConvention: true, }, }; diff --git a/templates/express/remix.config.js b/templates/express/remix.config.js index 378d0fc051f..77275da4ce2 100644 --- a/templates/express/remix.config.js +++ b/templates/express/remix.config.js @@ -11,7 +11,6 @@ export default { v2_errorBoundary: true, v2_headers: true, v2_meta: true, - v2_normalizeFormMethod: true, v2_routeConvention: true, }, }; diff --git a/templates/fly/remix.config.js b/templates/fly/remix.config.js index 60aa1cad1d6..86b6b7000d8 100644 --- a/templates/fly/remix.config.js +++ b/templates/fly/remix.config.js @@ -11,7 +11,6 @@ module.exports = { v2_errorBoundary: true, v2_headers: true, v2_meta: true, - v2_normalizeFormMethod: true, v2_routeConvention: true, }, }; diff --git a/templates/netlify/remix.config.js b/templates/netlify/remix.config.js index f54a5a8d198..62f8db8c29c 100644 --- a/templates/netlify/remix.config.js +++ b/templates/netlify/remix.config.js @@ -15,7 +15,6 @@ module.exports = { v2_errorBoundary: true, v2_headers: true, v2_meta: true, - v2_normalizeFormMethod: true, v2_routeConvention: true, }, }; diff --git a/templates/remix/remix.config.js b/templates/remix/remix.config.js index 60aa1cad1d6..86b6b7000d8 100644 --- a/templates/remix/remix.config.js +++ b/templates/remix/remix.config.js @@ -11,7 +11,6 @@ module.exports = { v2_errorBoundary: true, v2_headers: true, v2_meta: true, - v2_normalizeFormMethod: true, v2_routeConvention: true, }, }; diff --git a/templates/vercel/remix.config.js b/templates/vercel/remix.config.js index f688ad4857b..b49d80dff4e 100644 --- a/templates/vercel/remix.config.js +++ b/templates/vercel/remix.config.js @@ -15,7 +15,6 @@ module.exports = { v2_errorBoundary: true, v2_headers: true, v2_meta: true, - v2_normalizeFormMethod: true, v2_routeConvention: true, }, };