Skip to content

Use Turbo.fetch to prevent page refreshes bounces#23

Merged
marcelolx merged 1 commit into
rails:mainfrom
thiagoyoussef:turbo-fetch-prevent-page-refresh-bounces
Dec 11, 2025
Merged

Use Turbo.fetch to prevent page refreshes bounces#23
marcelolx merged 1 commit into
rails:mainfrom
thiagoyoussef:turbo-fetch-prevent-page-refresh-bounces

Conversation

@thiagoyoussef

@thiagoyoussef thiagoyoussef commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

Extracted from fizzy as requested by @jorgemanrubia at basecamp/fizzy@ebf8490

@jorgemanrubia jorgemanrubia left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks @thiagoyoussef 👏.

@jorgemanrubia

Copy link
Copy Markdown

@dhh @jeremy could we get this one merged please?

@marcelolx marcelolx merged commit 0af599e into rails:main Dec 11, 2025
@marcelolx

Copy link
Copy Markdown
Collaborator

Merged @jorgemanrubia!

@marcelolx

Copy link
Copy Markdown
Collaborator

We will have to fix this in https://github.com/rails/request.js, though

@marcelolx

marcelolx commented Dec 11, 2025

Copy link
Copy Markdown
Collaborator

@jorgemanrubia just so I fully understand this, essentially, it would be ideal for request.js to always use Turbo's fetch when available, not just for a specific response kind?

@marcelolx

Copy link
Copy Markdown
Collaborator

Ok, changing it on the request.js repo, here is the PR rails/request.js#90

@marcelolx

Copy link
Copy Markdown
Collaborator

Ok, released v13 of the js package https://github.com/rails/request.js/releases/tag/v0.0.13, and v14 of the gem https://github.com/rails/requestjs-rails/releases/tag/v0.0.14

@thiagoyoussef

Copy link
Copy Markdown
Contributor Author

Will send the follow-up PR to Fizzy, thanks guys!

@jorgemanrubia

Copy link
Copy Markdown

it would be ideal for request.js to always use Turbo's fetch when available, not just for a specific response kind?

Yes, exactly. The response kind filter didn't really make sense here: we want that whenever you use this library to make fetch requests, it triggers the Turbo mechanism to prevent self-triggered page refreshes, regardless the response kind (which can't be really anticipated). Thanks for merging it 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants