Skip to content

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

Merged
dhh merged 1 commit intohotwired:mainfrom
seanpdoyle:fetch-request-error-visit
Sep 14, 2022
Merged

Dispatch turbo:fetch-request-error during Visits#685
dhh merged 1 commit intohotwired:mainfrom
seanpdoyle:fetch-request-error-visit

Conversation

@seanpdoyle
Copy link
Copy Markdown
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
Copy Markdown
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.
@seanpdoyle seanpdoyle force-pushed the fetch-request-error-visit branch from 8c85542 to e3be82f Compare September 14, 2022 13:53
@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