Lazy-loading Turbo Frames for performance

5377
0

Loading everything on initial page render slows perceived performance. Lazy-loaded Turbo Frames defer expensive content until it's needed, keeping initial page loads fast. Setting loading='lazy' with a src attribute tells Turbo to fetch content when the frame enters the viewport. I use this for comment sections, user activity feeds, or related content that's below the fold. The server endpoint returns just the frame content, not the full page layout. Users on slow connections get the critical content first, then secondary content streams in as they scroll. The pattern also works for click-to-reveal scenarios where loading='lazy' is omitted but src is still provided.