Rails
VloĆŸit
- Äas pĆidĂĄn 26. 04. 2024
- Turbo 8 adds a new technique of sending HTML over the wire: "refresh current page, preserve scroll".
This new approach opens EASYER ways to render elements on current page without passing too much context to TurboStreams.
đźââïž however there some tricky scenarios that you should be aware of! đš
Level 1: We will try using PageRefreshes on a new Rails app.
Level 2: Use page refreshes to live-update nested comments in a real app.
Get access to superails.com source code:
1. Sign in to superails.com with Github
2. Leave a comment under the video superails.com/posts/rails-156...
Episode source code: github.com/corsego/156-turbo8...
Based on this blogpost: blog.corsego.com/hotwire-turb...
0:00 Turbo 8 intro
2:44 Update Table with TurboStreams
6:10 Install Turbo8, enable morphing
10:16 preserve some elements after morph
11:46 live updates
16:18 Turbo Morphing in a real app
This is such a powerful feature, so we can now make pages interactive with no SPA.
THANK GOD I decided to go all in with rails and leave react and vue behind this is amazing!
This is so great man. I love seeing Turbo 8 used incrementally and across so many contexts. Thanks so much for your time and explanations for all of this. I look forward to trying this out asap.
Thank you
great video, you never let me down, all that stuff arround morpho is making a lot of noise, it's good to know what is the real benefit, i think morpho's a great feature that make turbo ecosystem even better
Hey thanks for the video (turbo morphing video). In it you have to add the turbo_refreshes_with method within the HEAD tag. But you have also added "yield :head" -----> is this really necessary for morphing?
Useful : )
well, my turbo_refreshes_with method: :morph, scroll: :preserve line doesn't work. i keep getting full refresh with scroll reset. any idea why
did u restart the server after install it
1) are you sure you also add the âyieldâ in the head?
2) are you sure you are using gem turbo-rails v2beta?
â@@SupeRails ĐżŃĐžĐČĐ”Ń Ń ĐŒĐ”ĐœŃ ŃĐ°Đș жД бŃлО Ń ŃŃĐžĐŒ ĐżŃĐŸĐ±Đ»Đ”ĐŒŃ ĐżĐŸŃлД ŃĐŸĐłĐŸ ĐșĐ°Đș ĐŸĐ±ĐœĐŸĐČОл ĐœĐ° pre.beta.2.
â@@SupeRails turbo_refreshes_with method: :morph, scroll: :preserve
â@@TheVimeo yes certainly. it still does not work. I am submitting my form via stimilus. Thats the only difference, and i havent been able to solve it yet
Do you realize that you canât put two sentences together without saying âeHhâ?
Thanks for the feedback! I will try to improve