Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jozan/bun-remix-form-bug
repro of missing formData
https://github.com/jozan/bun-remix-form-bug
Last synced: 25 days ago
JSON representation
repro of missing formData
- Host: GitHub
- URL: https://github.com/jozan/bun-remix-form-bug
- Owner: jozan
- Created: 2023-08-02T21:13:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-02T22:12:46.000Z (over 1 year ago)
- Last Synced: 2024-11-14T11:17:31.364Z (3 months ago)
- Language: TypeScript
- Size: 136 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bun + remix form data bug
## environment
```sh
$ bun --version
0.7.1
$ sw_vers
ProductName: macOS
ProductVersion: 13.5
BuildVersion: 22G74
```## setup
```sh
bun install
bun run dev
```then go to [http://localhost:3000](http://localhost:3000)
## the bug
i have two forms in index route. the first one is `useFetcher` form and the other just plain old form.
when submitting either of the form their body is dropped when it reaches `action` handler. `await request.formData()` returns `{}`.
when i copy the post request from dev tools as cURL command and run it the `request.formData()` gets populated correctly.
`app/routes/_index.tsx`
```ts
import { json, type ActionArgs, type V2_MetaFunction } from "@remix-run/node";
import { useFetcher } from "@remix-run/react";export const meta: V2_MetaFunction = () => {
return [
{ title: "New Remix App" },
{ name: "description", content: "Welcome to Remix!" },
];
};export async function action({ request }: ActionArgs) {
console.log(request);
console.log(request.method);
console.log(await request.formData());return json({ hello: "world" });
}export default function Index() {
const fetcher = useFetcher();
return (
fetcher form
form form
);
}
```