Skip to content

Commit

Permalink
v2: remove future.v2_normalizeFormMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Jul 20, 2023
1 parent ad24428 commit 674ddcf
Show file tree
Hide file tree
Showing 23 changed files with 17 additions and 52 deletions.
9 changes: 9 additions & 0 deletions .changeset/v2-remove-normalize-form-method.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions docs/hooks/use-navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ function SomeComponent() {
}
```

<docs-warning>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.</docs-warning>

<docs-info>For more information and usage, please refer to the [React Router `useNavigation` docs][rr-usenavigation].</docs-info>

[rr-usenavigation]: https://reactrouter.com/hooks/use-navigation
Expand Down
15 changes: 7 additions & 8 deletions docs/pages/api-development-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion integration/action-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ test.describe("actions", () => {
future: {
v2_routeConvention: true,
v2_errorBoundary: true,
v2_normalizeFormMethod: true,
},
},
files: {
Expand Down
1 change: 0 additions & 1 deletion integration/defer-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ test.describe("non-aborted", () => {
future: {
v2_routeConvention: true,
v2_errorBoundary: true,
v2_normalizeFormMethod: true,
},
},
files: {
Expand Down
1 change: 0 additions & 1 deletion integration/hmr-log-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
1 change: 0 additions & 1 deletion integration/hmr-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
5 changes: 0 additions & 5 deletions integration/navigation-state-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 0 additions & 2 deletions packages/remix-dev/__tests__/readConfig-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
},
Expand All @@ -52,7 +51,6 @@ describe("readConfig", () => {
"v2_errorBoundary": Any<Boolean>,
"v2_headers": Any<Boolean>,
"v2_meta": Any<Boolean>,
"v2_normalizeFormMethod": Any<Boolean>,
"v2_routeConvention": Any<Boolean>,
},
"mdx": undefined,
Expand Down
12 changes: 0 additions & 12 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ interface FutureConfig {
v2_errorBoundary: boolean;
v2_headers: boolean;
v2_meta: boolean;
v2_normalizeFormMethod: boolean;
v2_routeConvention: boolean;
}

Expand Down Expand Up @@ -456,10 +455,6 @@ export async function readConfig(
errorBoundaryWarning();
}

if (!appConfig.future?.v2_normalizeFormMethod) {
formMethodWarning();
}

if (!appConfig.future?.v2_meta) {
metaWarning();
}
Expand Down Expand Up @@ -882,7 +877,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,
};

Expand Down Expand Up @@ -1104,12 +1098,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",
Expand Down
8 changes: 1 addition & 7 deletions packages/remix-react/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});

Expand Down
1 change: 0 additions & 1 deletion packages/remix-react/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export interface FutureConfig {
v2_errorBoundary: boolean;
v2_headers: boolean;
v2_meta: boolean;
v2_normalizeFormMethod: boolean;
v2_routeConvention: boolean;
}

Expand Down
1 change: 0 additions & 1 deletion packages/remix-server-runtime/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export interface FutureConfig {
v2_errorBoundary: boolean;
v2_headers: boolean;
v2_meta: boolean;
v2_normalizeFormMethod: boolean;
v2_routeConvention: boolean;
}

Expand Down
1 change: 0 additions & 1 deletion packages/remix-testing/create-remix-stub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export function createRemixStub(
v2_errorBoundary: false,
v2_headers: false,
v2_meta: false,
v2_normalizeFormMethod: false,
v2_routeConvention: false,
...remixConfigFuture,
},
Expand Down
1 change: 0 additions & 1 deletion templates/arc/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default {
v2_errorBoundary: true,
v2_headers: true,
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
},
};
1 change: 0 additions & 1 deletion templates/cloudflare-pages/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default {
v2_errorBoundary: true,
v2_headers: true,
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
},
};
1 change: 0 additions & 1 deletion templates/cloudflare-workers/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default {
v2_errorBoundary: true,
v2_headers: true,
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
},
};
1 change: 0 additions & 1 deletion templates/deno/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module.exports = {
v2_errorBoundary: true,
v2_headers: true,
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
},
};
1 change: 0 additions & 1 deletion templates/express/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default {
v2_errorBoundary: true,
v2_headers: true,
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
},
};
1 change: 0 additions & 1 deletion templates/fly/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
v2_errorBoundary: true,
v2_headers: true,
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
},
};
1 change: 0 additions & 1 deletion templates/netlify/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module.exports = {
v2_errorBoundary: true,
v2_headers: true,
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
},
};
1 change: 0 additions & 1 deletion templates/remix/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
v2_errorBoundary: true,
v2_headers: true,
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
},
};
1 change: 0 additions & 1 deletion templates/vercel/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module.exports = {
v2_errorBoundary: true,
v2_headers: true,
v2_meta: true,
v2_normalizeFormMethod: true,
v2_routeConvention: true,
},
};

0 comments on commit 674ddcf

Please sign in to comment.