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

Add future.v7_normalizeFormMethod flag #10207

Merged
merged 3 commits into from
Mar 15, 2023

Conversation

brophdawg11
Copy link
Contributor

Add a future flag to normalize/align useNavigation().formMethod and useFetcher().formMethod with Remix.

We want our API to behave like fetch() - it can accept lowercase or uppercase, but exposes the method back to you as a normalized uppercase method:

new Request("/", { method: "post" }).method === "POST" // true
new Request("/", { method: "POST" }).method === "POST" // true

So this means that both <Form method="post"> and <Form method="POST"> should result in useNavigation().formMethod === "POST".

We inadvertently shipped lowercase useNavigation/useFetcher values in 6.4, and only noticed the inconsistency when we went to deprecate useTransition in Remix which used uppercase. Therefore, we're putting this behind a future flag tro avoid breaking apps, and in Remix v2/React Router v7 we'll move to uppercase as the default.

@changeset-bot
Copy link

changeset-bot bot commented Mar 15, 2023

🦋 Changeset detected

Latest commit: ae419d1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
react-router Minor
react-router-dom Minor
@remix-run/router Minor
react-router-dom-v5-compat Minor
react-router-native Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants