Hotwire Discussion

Catching failed fetch requests due to lost network connection

Hi folks,

Does anybody have any suggestions for how to handle the situation in which the browser’s network connection is offline after the page loads and before a Turbo form submission is triggered?

In my testing it seems that the failure of the fetch request is logged to the console, but there’s not really much else I can do as a Turbo user to recover from the error? I was hoping, for example, that there might be a Turbo event that I could bind to and then gracefully recover (such as by displaying a “Whoops: looks like you’re offline” element).

Any thoughts about how to handle this situation?

Cheers,
Louis.

1 Like