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

Dispatch turbo:fetch-request-error during Visits #685

Merged
merged 1 commit into from
Sep 14, 2022

Conversation

seanpdoyle
Copy link
Contributor

@seanpdoyle seanpdoyle commented Aug 16, 2022

Follow-up to #640
Related to hotwired/turbo-site#110

When a Visit results in a fetch error (like when the browser is
offline), dispatch a turbo:fetch-request-error event in the same style
as <turbo-frame>- and <form>-initiated fetch errors.

For the sake of consistency, also make the TurboFetchRequestErrorEvent
cancelable.

Along with the implementation change, this commit also adds test
coverage to ensure that the Event.target is correct for
<turbo-frame> and <form> error events.

Copy link
Contributor

@srt32 srt32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

@seanpdoyle seanpdoyle force-pushed the fetch-request-error-visit branch 19 times, most recently from cb34bf6 to 731eb91 Compare August 17, 2022 00:23
@seanpdoyle seanpdoyle force-pushed the fetch-request-error-visit branch 7 times, most recently from 283bc3b to 8c85542 Compare September 14, 2022 13:43
Follow-up to hotwired#640
Related to hotwired/turbo-site#110

When a `Visit` results in a `fetch` error (like when the browser is
offline), dispatch a `turbo:fetch-request-error` event in the same style
as `<turbo-frame>`- and `<form>`-initiated `fetch` errors.

For the sake of consistency, also make the `TurboFetchRequestErrorEvent`
cancelable.

Along with the implementation change, this commit also adds test
coverage to ensure that the `Event.target` is correct for
`<turbo-frame>` and `<form>` error events.
@dhh dhh merged commit 2332d3d into hotwired:main Sep 14, 2022
@seanpdoyle seanpdoyle deleted the fetch-request-error-visit branch September 14, 2022 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants