forked from hotwired/turbo-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Type Safety Guards to
turbo/fetch_requests
(hotwired#403)
* Add Type Safety Guards to `turbo/fetch_requests` Without this change, GET `<form>` submissions without a Fetch Options `{ body: }` raise the following: ``` Uncaught TypeError: s.body is null <anonymous> fetch_requests.js:10 w turbo.es2017-esm.js:351 requestStarted turbo.es2017-esm.js:770 perform turbo.es2017-esm.js:520 start turbo.es2017-esm.js:744 formSubmitted turbo.es2017-esm.js:3369 ``` Through the exercise of attempting to [port the `turbo/fetch_requests` module to TypeScript](hotwired#392 (comment)), we've identified some potential edge cases in the algorithm that determines a request's HTTP method. Even if the migration to TypeScript doesn't come to fruition for some time, those edge cases should be addressed sooner rather than later. This commit adds more "type safety" motivated conditionals and guards to make sure that values are present before overriding them. * Resolve Turbo Stream test flakiness Replace looping mechanisms with Capybara assertion for the presence of a `<turbo-cable-stream-source>` element.
- Loading branch information
1 parent
2a80b2c
commit cf69d2a
Showing
8 changed files
with
96 additions
and
23 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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