-
Notifications
You must be signed in to change notification settings - Fork 41
Add supports for render
in controllers
#40
Comments
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. |
Any news on this? |
@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! |
@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. |
I believe @sstephenson and @javan suggested this might be included in Turbolinks 6 on the Remote Ruby podcast:
|
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 🤷🏽♂️. |
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 really hope a solution like this will go into Rails/Turbolinks by default. |
Ping @sstephenson @rafaelfranca, it would be really great to hear the Turbolinks team official stance on this! 😄 |
Please let's have this in core! |
yes. js in rails needs to work or all-js starts feeling better ;-/ |
@sstephenson @rafaelfranca - Another vote to include in core. Sure seems like the missing link... |
I can confirm Turbolinks 6 will handle form submissions in a way that makes this unnecessary, among many other goodies 😀 |
@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 |
@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. |
@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? 😄 |
My recommendation would still be |
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 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. |
Additionally I have no idea where turbolinks 6 is (there is no branch with that name and I don't see a I guess I'll go with |
@amitsaxena Unfortunately you're right, there is not much info on when the next version of Turbolinks will be available.
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: |
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 |
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! |
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. |
This is handled now in latest turbo beta. Kudos to @seanpdoyle for tackling this! |
@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. |
I published a gem that adds support for
render
in Rails controllers when using Turbolinks.I think this should be officially supported by Turbolinks and I am willing to work on that PR.
I would include a comprehensive suite of tests as part of the PR, and I am willing to follow any guideline or consideration you may have. I just don't want to do the work if there is no hope to have it used.
As mentioned in this comment:
The text was updated successfully, but these errors were encountered: