Skip to content

Commit 4740d4f

Browse files
justin808claude
andcommitted
Update Pro dummy app and docs to use modern Turbo syntax
Address inconsistencies identified in the Turbo migration by updating: 1. Pro version dummy app layout (react_on_rails_pro/spec/dummy/app/views/layouts/application.html.erb): - Change 'data-turbolinks-track': true to 'data-turbo-track': 'reload' - Ensures consistency with main dummy app which was already updated 2. Documentation (docs/building-features/turbolinks.md): - Clarify Turbolinks 5.x vs 2.x syntax differences - Add note pointing users to modern Turbo syntax - Improve readability of legacy Turbolinks section These changes complete the Turbo migration across all dummy apps and provide clearer guidance for users on the recommended modern approach. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d5a5f27 commit 4740d4f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

docs/building-features/turbolinks.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,21 @@ This definitely can make an app perform better, even if the JavaScript and style
128128
1. Include turbolinks via yarn as shown in the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/blob/8a6c8aa2e3b7ae5b08b0a9744fb3a63a2fe0f002/client/webpack.client.base.config.js#L22) or include the gem "turbolinks".
129129
1. Included the proper "track" tags when you include the javascript and stylesheet:
130130

131+
**For Turbolinks 5.x:**
132+
131133
```erb
132134
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => 'reload' %>
133135
<%= javascript_include_tag 'application', 'data-turbolinks-track' => 'reload' %>
134136
```
135137

136-
NOTE: for Turbolinks 2.x, use `'data-turbolinks-track' => true`
138+
**For Turbolinks 2.x (Classic):**
139+
140+
```erb
141+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
142+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
143+
```
144+
145+
**Note:** If you're using modern Turbo (recommended), use `'data-turbo-track' => 'reload'` instead of `'data-turbolinks-track'`. See the "Using Turbo" section at the top of this document.
137146

138147
1. Add turbolinks to your `application.js` file:
139148
```javascript

react_on_rails_pro/spec/dummy/app/views/layouts/application.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
</style>
2323
<%= stylesheet_pack_tag('client-bundle',
2424
media: 'all',
25-
'data-turbolinks-track': true) %>
25+
'data-turbo-track': 'reload') %>
2626

2727
<%# Used for testing purposes to simulate hydration failure %>
2828
<% unless params[:skip_js_packs] == 'true' %>
29-
<%= javascript_pack_tag('client-bundle', 'data-turbolinks-track': true, defer: false) %>
29+
<%= javascript_pack_tag('client-bundle', 'data-turbo-track': 'reload', defer: false) %>
3030
<% end %>
3131
<%= csrf_meta_tags %>
3232
</head>

0 commit comments

Comments
 (0)