Skip to content

Two refreshes causes exception: The operation was aborted. #1091

@edwinv

Description

@edwinv

Running 8.0.0-beta.1, testing in Firefox 118.

We have a page which is subscribed to two types of streams:

  • A stream for the parent
  • A stream for each child visible on the page

When a child changes, it touches the parent. Therefore two refresh actions are sent shortly after each other, refreshing the same page. This causes the second request to cancel the first one. This raises an exception:

Uncaught (in promise) DOMException: The operation was aborted. 
    cancel turbo.es2017-esm.js:760
    cancel turbo.es2017-esm.js:2297
    stop turbo.es2017-esm.js:3003
    startVisit turbo.es2017-esm.js:2981
    visitProposedToLocation turbo.es2017-esm.js:2625
    visitProposedToLocation turbo.es2017-esm.js:4804
    proposeVisit turbo.es2017-esm.js:2976

The exception causes the whole page to be refreshed by the browser instead of in a fetch request.

There are two things that might be a bug here:

  1. I'm testing the refreshes by manually changing data through a Rails console. This doesn't set the Turbo.current_request_id, which is used in the debouncer. So I really get to refreshes closely after each other. But given there are two streams, they still both should update. In production we do a lot of data handling with jobs (Sidekiq) and you also don't get a Turbo.current_request_id, so the debouncer might not work as expected.
  2. When the first visit is cancelled because we are doing a second visit, I would expect Turbo not to raise an exception. You just want to have the latest information, so the second request has more priority and you can discard the response from the first request. So the raised exception can probably be ignored for this situation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions