DEV Community

Discussion on: Sort tables (almost) instantly with Ruby on Rails and StimulusReflex

Collapse
 
davidcolbyatx profile image
David Colby

Hey Leonid, I published an article this morning implementing the same functionality with turbo frames that might be helpful for you to see how the same thing can be done with frames: dev.to/davidcolbyatx/sort-tables-a...

For me personally, I find myself using SR, CR, and Frames inside the same application, Frames do really simple things (like inline editing a record in a table) very well.

StimulusReflex is what I reach for on more complex front end interactions when I know I'm going to need before/after callbacks, and when I don't want to pollute my controller with non-RESTful routes or conditionals to try to render a partial sometimes and full-page turn other times. Both of those issues come up frequently when relying entirely on Frames and Streams.

CableReady tends to be a direct, complete replacement for Streams for me in most cases. Streams are great, and work well, but I've just found myself enjoying building with CableReady more than with Streams after using both extensively. I suspect some teams will stick with Streams and be very successful with them, especially teams that got used to using js.erb templates since Streams end up looking and feeling very similar to that approach.

A helpful point of comparison for Streams vs. CR might be the articles I've written on using each option to submit a modal form:

With Frames and Streams: dev.to/davidcolbyatx/handling-moda... (this article could use some updates, but the general approach still stands!)

With CableReady and mrujs: dev.to/davidcolbyatx/server-render...