Comments (24)
I can confirm Turbolinks 6 will handle form submissions in a way that makes this unnecessary, among many other goodies 😀
from turbolinks-rails.
@MrHubble I am not working on Turbolinks 6. @sstephenson and @javan are. It will introduce a bunch of new features that, among other things, will solve the problem this gem addressed. It will use a different approach compared to the gem, so it should not affect to your decision of using the gem now (it won't make adopting it harder or easier).
Sorry I can't share more details yet. Hopefully we'll have exciting news about the new version next year. I attended an internal presentation and all I can say is that it's going to be huge.
from turbolinks-rails.
I'm a new Rails user and I was really confused with forms not just working. At first nothing was working because a xhr request occurred and I didn't know I should handle it. I then handled it with custom javascript to only replace the form, but error handling was not working correctly.
I then installed this Gem and now it works as I hoped it would the first time.
I really hope a solution like this will go into Rails/Turbolinks by default.
from turbolinks-rails.
Support for form validations is totally in the plans. There is a PR here with a proposed solution. We discussed this internally before releasing Hotwire and, while it was left out for launch, we agreed this was necessary as it's a common Rails pattern.
from turbolinks-rails.
Please let's have this in core!
from turbolinks-rails.
I believe @sstephenson and @javan suggested this might be included in Turbolinks 6 on the Remote Ruby podcast:
They each share how they got started programming, a brief insight into how they work at Basecamp, the transition from CoffeeScript to ES6, Typescript, as well as (wait for it...) upcoming features in Stimulus (🙌) and considerations for Turbolinks 6 (no feature promises made 😉).
from turbolinks-rails.
Nice work @jorgemanrubia! I agree, that this (or something similar) should be enabled in Rails by default so default remote forms don't need any custom SJR. And if they need it, then Turbolinks can be disabled for the action and custom SJR can be returned.
from turbolinks-rails.
@sstephenson @rafaelfranca could you please weight in on this one? I am really good with any decision, I just suspect this hasn't even entered into your radar yet.
In addition to my comment above, I wrote a couple of pieces on why I think this should be officially supported by Rails:
The library got much better on latest iterations but I know there are probably additional scenarios to handle. As mentioned above, I'd love to put the work to make this happen.
Thanks!
from turbolinks-rails.
Thanks @MrHubble, that's great news. I haven't been able to get any kind of response on this one despite of trying different channels so I'll grasp at this 🤷🏽♂️.
from turbolinks-rails.
I can confirm Turbolinks 6 will handle form submissions in a way that makes this unnecessary, among many other goodies 😀
Hey @jorgemanrubia, now that hotwire is out, do you think this is still relevant? It seems the gem you have created and hotwire works a bit different. Your gem replaces the whole page and is very automatic, whereas hotwire requires to add respond_to turbo_stream
for every form and it creates a lot of work. I still think it would be really great to have something like this in the core (or maybe v2 of your gem 😄 )
from turbolinks-rails.
This is handled now in latest turbo beta. Kudos to @seanpdoyle for tackling this!
from turbolinks-rails.
@jorgemanrubia @seanpdoyle It actually works only for the error scenario. For the happy path, if the form submission simply render something, it doesn't (yet) works.
Scenario where you do some in-place editing (so you POST some data, but stay on the same page with some valid feeback displayed) are actually pretty common.
How to handle this right now ?
from turbolinks-rails.
@sstephenson @rafaelfranca - Another vote to include in core. Sure seems like the missing link...
from turbolinks-rails.
@amitsaxena Unfortunately you're right, there is not much info on when the next version of Turbolinks will be available.
There is a thread about it on the Rails discussion forum: https://discuss.rubyonrails.org/t/turbolinks-and-stimulus-are-developed-behind-a-wall/75124
It would be so nice if the defaults for forms were fixed and the rails guides gave examples of how to build forms in a rails app.
The Rails guides are open-source and everyone can contribute! If you can't find something that you think should be in there, consider adding it:
https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-documentation
from turbolinks-rails.
Any news on this?
from turbolinks-rails.
@jorgemanrubia This looks great! We need this in rails core, or something similar. My only addition would be to allow the scroll position reset to be optionally disabled as this can sometimes be useful on a search results page; so that you can do dynamic filtering etc.
from turbolinks-rails.
Ping @sstephenson @rafaelfranca, it would be really great to hear the Turbolinks team official stance on this! 😄
from turbolinks-rails.
yes. js in rails needs to work or all-js starts feeling better ;-/
from turbolinks-rails.
@jorgemanrubia that's great news! Is this something you're personally working on at Basecamp?
For someone who has yet to tackle this problem, would you recommend using your turbolinks-render gem or wait for Turbolinks 6 to be released? The main concerns are ease of migrating from turbolinks_render
to use Turbolinks 6, and the unknowns around a potential release date for Turbolinks 6.
from turbolinks-rails.
@jorgemanrubia I guess no movement on this or Turbolinks 6 even after more than an year? What's the recommended way to handle remote forms these days? 😄
from turbolinks-rails.
My recommendation would still be turbolinks-rails
until Turbolinks 6 is released. I know it's taking a long time. Hadn't being this year so crazy it would be already out.
from turbolinks-rails.
Creating simple forms in a fresh rails 6 app is a pain these days. I miss the golden convention our configuration days when it was so simple to keep moving 😄
For some reason redirect_to
now no longer works for my turbolinks forms (though it seems to work in a fresh app). The logs say Redirected to xyz
but no real redirect happens. Not sure what's happening. Also relying on redirect for ajax requests seems fragile to me given what if future versions of rails just broke this behaviour (not sure if redirect_to works across all remote requests even now). Other people seemingly are complaining about rails forms as well:
https://discuss.rubyonrails.org/t/default-handling-of-remote-forms/74680
It would be so nice if the defaults for forms were fixed and the rails guides gave examples of how to build forms in a rails app. The current information is scattered and incomplete. Or have we just assumed that everyone is using SPAs these days. The barrier to entry for a newcomer seems significant as of now and I am not sure if that's helpful for growing the community.
from turbolinks-rails.
Additionally I have no idea where turbolinks 6 is (there is no branch with that name and I don't see a turbolinks-next
either) and if it is being worked upon. So I have no idea if it's coming in 2020 or 2025 🤔
I guess I'll go with local: true
for now (default rails scaffolds seem to be using that hack as well instead of doing it the recommended rails way) to move forward.
from turbolinks-rails.
I had two hopes for Hotwire: that it would fix remote form validations and provide a viable Android wrapper. I am grateful for the Android wrapper, don't doubt for a moment.
I created Optimism to handle validations for remote UJS forms. I was really excited to sunset the library, because it shouldn't need to exist.
You're our human on the inside. Please, we're counting on you!
from turbolinks-rails.
Related Issues (20)
- Shouldn't the default visit option still be `advance`? HOT 3
- Do not split assets into separate gem
- "respond_with" via responders ignores JavaScript redirections
- Why not request.fullpath? HOT 2
- Problems with server-side rendering after upgrading from classic HOT 4
- Turbolinks JavaScript object not available in production HOT 3
- Usage when the assets pipeline is disabled HOT 2
- Provide "source url" on rubygem.org
- Redirection bug if your controller defines `location` HOT 3
- Add dependency on coffee-rails HOT 3
- PR #25 Did not include require statement for added rendering file. HOT 1
- How to avoid redirecting to a single route when using `remote: true` link from two different pages HOT 2
- Cache is not cleared with `advance` redirect HOT 1
- undefined method `get?' for 302:Integer HOT 1
- suggestion to have gem without javascript dependency HOT 1
- assert_redirected_to behaving oddly with Rails 6 HOT 2
- redirect_to in rspec failing
- 5.0.0.beta2 / redirect_to with turbolinks action 'change' renders {"action":"replace"} instead of { change: [...] } HOT 1
- Is this version going to support Rails 3.2? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turbolinks-rails.