[HN Gopher] Using Turbo Frames and Streams Without Rails
       ___________________________________________________________________
        
       Using Turbo Frames and Streams Without Rails
        
       Author : tortilla
       Score  : 48 points
       Date   : 2023-12-01 04:23 UTC (18 hours ago)
        
 (HTM) web link (radanskoric.com)
 (TXT) w3m dump (radanskoric.com)
        
       | aantix wrote:
       | The new Turbo 8 allows you to just re-render your page, and using
       | DOM morphing, it will just figure out which divs to update.
        
         | nickjj wrote:
         | Yep this is really good stuff.
         | 
         | The only concern I have is around making things more efficient
         | server side.
         | 
         | For example if you have an expensive DB query that's not really
         | cacheable, you can use streams and frames to only have that
         | query execute once on the first page load but then you can
         | navigate between pages that only load in a different frame.
         | 
         | A good example is something like a video course platform with a
         | video frame, table of contents area and another frame below the
         | video to load specific things like questions, references, show
         | notes, etc.. As you click links in the table of contents, it
         | loads new content in the video frame but the questions wouldn't
         | change and you also don't need to re-render the table of
         | contents either. You get to skip querying and rendering views
         | for all of those expensive things.
         | 
         | With Turbo 8, if you used the new approach you would be
         | rendering non-cacheable very expensive queries and views on
         | every page transition. I want to use Turbo 8's features so much
         | but for the biggest and most complex aspect of my app I don't
         | realistically see how I can. The bookkeeping pain on manually
         | updating 5+ areas of the page and writing a bunch of stream
         | hooks which is multiplied as you add more actions is real
         | though.
         | 
         | I'm hoping as Turbo 8 gets more mature new patterns will emerge
         | to let us get the best of both worlds (performance and
         | complexity compression).
        
       | xutopia wrote:
       | Turbo frames and streams are a wonderful pattern that I wished
       | was used more than it is. We see people resort to whole React
       | frontends for their web applications just to add simple features
       | that could be done nearly for free using frame and streams.
        
       | jadbox wrote:
       | I'm not familiar with Turbo Frames, but it kinda sounds like Htmx
       | approach. Can someone help me understand the differences?
        
         | infecto wrote:
         | They are in the same wheelhouse. HTMX is more generalized,
         | Turbo/Hotwire is more opinionated. HTMX can easily be run
         | anywhere in any language. Turbo is easiest run in Rails/Ruby.
        
           | williamcotton wrote:
           | I've used Turbo with a web app written in C:
           | 
           | https://github.com/williamcotton/express-c/blob/master/demo/.
           | ..
           | 
           | https://github.com/williamcotton/express-c/blob/master/demo/.
           | ..
           | 
           | :)
        
       | wilg wrote:
       | I threw Turbo on a static site and did a little preloading and it
       | seemed to work great. https://videovillage.com
        
         | tortilla wrote:
         | Nice looking site!
        
       ___________________________________________________________________
       (page generated 2023-12-01 23:01 UTC)