-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(remix-react): emulate put/patch/delete when JS is unavailable
References #4420 Ensure `<Form method=...>` behaves the same with and without JavaScript. Although native forms don't support PUT/PATCH/DELETE, we can emulate them by doing a POST and injecting a `_method` parameter into the action URL. The Remix server runtime then provides action handlers a `Request` with the overridden `method` so they are none the wiser. This provides a more reliable way to use these methods, which can be more ergonomic to write and handle than hidden inputs or buttons with values. Note: The emulation only works for action requests handled by Remix; if the form is submitted to another endpoint, it would need to handle the `_method` URL parameter accordingly.
- Loading branch information
Showing
5 changed files
with
50 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@remix-run/react": minor | ||
"@remix-run/server-runtime": minor | ||
--- | ||
|
||
emulate put/patch/delete when JS is unavailable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters