---
title: "A refreshing take: using serverside rendering to reduce fragile DOM state"
description: "Turbo's `refresh` stream action, unlike the original DOM-manipulating actions, exists to let servers broadcast \"re-fetch this page\" over Action Cable, with idiomorph morphing applying only the changed elements."
url: "https://swe.quest/articles/a-refreshing-take-using-serverside-rendering-to-reduce-fragile-dom-state-949880494b413aac"
canonical: "https://engineering.freeagent.com/2025/10/17/a-refreshing-take-using-serverside-rendering-to-reduce-fragile-dom-state/"
source: "FreeAgent Engineering"
published: "2025-10-17"
difficulty: "medium"
kind: "How-to"
reading_minutes: 8
tags: ["frontend","ruby","realtime"]
---

# A refreshing take: using serverside rendering to reduce fragile DOM state

A post on [FreeAgent Engineering](https://swe.quest/sources/freeagent.md), published 2025-10-17, 8 min read, How-to. Original: [https://engineering.freeagent.com/2025/10/17/a-refreshing-take-using-serverside-rendering-to-reduce-fragile-dom-state/](https://engineering.freeagent.com/2025/10/17/a-refreshing-take-using-serverside-rendering-to-reduce-fragile-dom-state/)

## Summary

Turbo's \`refresh\` stream action, unlike the original DOM-manipulating actions, exists to let servers broadcast "re-fetch this page" over Action Cable, with idiomorph morphing applying only the changed elements. The result is a mostly server-rendered Rails frontend that still updates in realtime without much custom JS. The catch is client-side DOM state such as open dropdowns, confirmation modals and in-progress uploads, which a refresh would wipe out. FreeAgent protects these with \`data-turbo-permanent\` or by cancelling morph events, and on state-heavy pages falls back to targeted \`update\`/\`replace\` streams or Turbo Frame reloads.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Ruby](https://swe.quest/tags/ruby.md) (Languages)
- [Real-time systems](https://swe.quest/tags/realtime.md) (Backend & APIs)

## Prerequisites

- Ruby on Rails basics ([easy posts on Ruby](https://swe.quest/tags/ruby.md?difficulty=easy))
- Hotwire Turbo
- WebSockets ([easy posts on Real-time systems](https://swe.quest/tags/realtime.md?difficulty=easy))

## Keywords

Hotwire, Turbo Streams, Action Cable, idiomorph, Stimulus, Turbo Frames, turbo\_power

## Related posts

- [Persisting nested form attribute indexes through Turbo updates](https://swe.quest/articles/persisting-nested-form-attribute-indexes-through-turbo-updates-0b3175a90493222c.md): FreeAgent Engineering · 2026-01-08 · Medium · 5 min read · Ruby, Frontend
  When a Turbo Stream replaces part of a Rails nested form, the replacement fields must keep the same attribute index as their siblings, which can be passed via the form builder's \`index\` property as a URL parameter and hidden field.
- [Alternatives to htmx](https://swe.quest/articles/alternatives-to-htmx-a851631752657e75.md): htmx essays · 2025-01-12 · Easy · 3 min read · Frontend, JavaScript, Open source
  Hypermedia-oriented web development has many implementations besides htmx, including Unpoly, the Triptych HTML spec proposals with a polyfill, fixi.js, Datastar, Nomini, µJS, Alpine AJAX, Hotwire Turbo, htmz, TwinSpark and jQuery's load().
- [How I shipped 39 PRs to prod as a non-developer](https://swe.quest/articles/how-i-shipped-39-prs-to-prod-as-a-non-developer-c158dc7f5a4bb51e.md): 8th Light · 2026-11-20 · Medium · 11 min read · AI for coding, Code review, Ruby, Engineering management, Product engineering
  A non-developer product manager shipped 39 production pull requests to a Rails/Hotwire client codebase using Claude Code and the team's Research-Plan-Implement agentic process.
- [Accelerating Mobile App development at Zalando with Rendering Engine and React Native](https://swe.quest/articles/accelerating-mobile-app-development-at-zalando-with-rendering-engine-and-react-ab66b7bbd44743eb.md): Zalando Engineering · 2025-10-02 · Medium · 11 min read · React, Mobile, Design systems, Refactoring & migrations, Frontend
  Zalando is incrementally migrating its separate iOS and Android apps to React Native by reusing Rendering Engine, its React-based web framework whose "renderers" bundle data fetching, caching, observability and tracking into components.
- [The fetch()ening](https://swe.quest/articles/the-fetch-ening-bd2a39a6794c1052.md): htmx essays · 2025-11-01 · Medium · 9 min read · Frontend, JavaScript, Browsers
  htmx 4.0 rebuilds the library's internals on fetch() instead of XMLHttpRequest, drawing on lessons from fixi.js, and makes three simplifying breaking changes: attribute inheritance becomes explicit via an :inherited modifier, history no longer snapshots the DOM locally but re-fetches content, and the event model is linearized with a new htmx:\<phase\>:\<system\> naming scheme.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
