-
Notifications
You must be signed in to change notification settings - Fork 415
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
Override isHTML or locationIsVisitable? #185
Comments
Just chiming in to say that this is an issue for my team also. I saw the PR that removed the Location class (#90), and that seems like a solid engineering decision, but now that it's not possible to patch Location.isHTML, we're not able to upgrade. The comment here is still applicable:
We've already upgraded to Stimulus 2.0 and we'd love to upgrade to Turbo as well. It seems a shame that there's no way to override the set of extensions that Turbo deems eligible for visiting. I really hope you'll consider making this possible again (in a better way than monkey-patching). |
This would be a big boon to small teams that don't have the resources to refactor all their routing just to support turbo. Some of us are in a very dire situation with our legacy code in this area ;). My team would be happy to submit a PR implementing this if the turbo team feels like this is worth supporting and if a design is settled on. |
Bumping because we still have this issue and would very much like to see it resolved or even help resolve it. We're currently monkey-patching turbo to accept |
Indeed it would be great if Turbo would support other extensions like .php as well. I know it's now part of the Rails community, but I think it's a great and easy way to create a SPA experience with PHP generated websites as well in a very simple way (Laravel Livewire needs Laravel). See also my discussion topic at: |
I'd like to present an argument that this issue should be a little higher priority: Hotwire is being marketed as being about JS on the client and HTML on the server, not as an extension of Ruby on Rails, so it seems strange that it excludes many PHP sites, which last I checked still accounts for some 80% of server-side code on the web. Yes, not all of PHP sites out there use urls that end in My team would be happy to work with maintainers to find a more acceptable way to configure than |
Issues related to this have popped up several times since this issue was opened in February 2021, most recently in #491 (comment) due to a change introduced in An internal or user-facing solution is definitely worth exploring. |
Lots of conversation here and wondering if I can't suggest what might be a simpler approach. Could we not allow overrides in this manner?
Then within the Turbo isHTML function itself you could:
|
Leaving my previous comment as a source of shame. It hadn't dawned on me that there was already this concept of "session" that accepted settings. Please consider this PR which makes use of the current convention. |
Let's consolidate the conversation on #519. |
Hello!
With turbolinks I used to do this:
Is this no longer possible with Turbo?
The default extension regex often trips me up, as a PHP developer I obviously expect
<turbo-frame id="messages" src="/messages.php">msg</turbo-frame>
to work.In my case some of my URLs happen to have periods in them, which Turbo fails to load correctly (e.g. /music/prince/1989.batman) because it parses the ".batman" part as the extension.
I also tried setting
data-turbo=true
, as settingdata-turbo=false
forces links to not be navigable or visitable, so I figured maybedata-turbo=true
forces it in the other direction, but it seems to just give me the default behavior.For now, the workaround I'm using is making sure my URLs end in a slash, as that seems to bypass the extension check, but it would be nice if there was some way to force Turbo to treat a particular link as navigable/visitable.
The text was updated successfully, but these errors were encountered: