Translation Update Required
The upstream documentation has been updated. Please review the changes and update the translation accordingly.
File: turbo/handbook/page_refreshes.md
Current translated commit: 0b2c287
Latest upstream commit: 4f4c385
Diff
Click to expand diff
diff --git a/_source/handbook/03_page_refreshes.md b/_source/handbook/03_page_refreshes.md
index 74daa71..5f6a856 100644
--- a/_source/handbook/03_page_refreshes.md
+++ b/_source/handbook/03_page_refreshes.md
@@ -22,7 +22,7 @@ You can configure how Turbo handles page refresh with a `<meta name="turbo-refre
</head>
```
-The possible values are `morph` or `replace` (the default). When it is `morph,` when a page refresh happens, instead of replacing the page's `<body>,` Turbo will only update the DOM elements that have changed, keeping the rest untouched. This approach delivers better sensations because it keeps the screen state.
+The possible values are `morph` or `replace` (the default). When it is `morph,` when a page refresh happens, instead of replacing the page's `<body>` contents, Turbo will only update the DOM elements that have changed, keeping the rest untouched. This approach delivers better sensations because it keeps the screen state.
Under the hood, Turbo uses the fantastic [idiomorph library](https://github.com/bigskysoftware/idiomorph).
@@ -52,8 +52,7 @@ Sometimes, you want to ignore certain elements while morphing. For example, you
You can use [turbo frames](/handbook/frames.html) to define regions in your screen that will get reloaded using morphing when a page refresh happens. To do so, you must flag those frames with `refresh="morph"`.
```html
-<turbo-frame id="my-frame" refresh="morph">
- ...
+<turbo-frame id="my-frame" refresh="morph" src="/my_frame">
</turbo-frame>
```
@@ -67,6 +66,14 @@ There is a new [turbo stream action](/handbook/streams.html) called `refresh` th
<turbo-stream action="refresh"></turbo-stream>
```
+Refresh behavior can be specified using the `method` and `scroll` attributes:
+
+```html
+<turbo-stream action="refresh" method="morph" scroll="preserve"></turbo-stream>
+```
+
+The `method` attribute can be `morph` or `replace`, and the `scroll` attribute can be `preserve` or `reset`.
+
Server-side frameworks can leverage these streams to offer a simple but powerful broadcasting model: the server broadcasts a single general signal, and pages smoothly refresh with morphing.
You can see how the [`turbo-rails`](https://github.com/hotwired/turbo-rails) gem does it for Rails:
How to Update
- Fork this repository
- Update the translation in
turbo/handbook/page_refreshes.md
- Update the
commit field in the front matter to 4f4c385
- Create a Pull Request with your changes
View changes on GitHub
Translation Update Required
The upstream documentation has been updated. Please review the changes and update the translation accordingly.
File:
turbo/handbook/page_refreshes.mdCurrent translated commit:
0b2c287Latest upstream commit:
4f4c385Diff
Click to expand diff
How to Update
turbo/handbook/page_refreshes.mdcommitfield in the front matter to4f4c385View changes on GitHub