Skip to content

Commit f54a102

Browse files
committed
Disable Turbo's prefetch, which became default in turbo-rails 2.x
Fixes #3701
1 parent 44579f0 commit f54a102

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

app/views/layouts/rails_admin/_head.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
33
<meta content="width=device-width, initial-scale=1" name="viewport; charset=utf-8">
44
<meta content="NONE,NOARCHIVE" name="robots">
5+
<meta content="false" name="turbo-prefetch">
56
<%= csrf_meta_tag %>
67
<% case RailsAdmin::config.asset_source
78
when :webpacker %>

spec/integration/rails_admin_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@
204204
is_expected.to have_content 'Player failed to be updated'
205205
is_expected.to have_css '.filtering-select[data-input-for="player_team_id"]'
206206
end
207+
208+
it 'does not prefetch pages' do
209+
allow_any_instance_of(RailsAdmin::Config::Actions::Index).to receive(:controller).and_raise('index prefetched')
210+
visit dashboard_path
211+
find('.sidebar a.nav-link[href$="/player"]').hover
212+
sleep 0.3 # Turbo waits 100ms before prefetch
213+
end
207214
end
208215

209216
describe 'dom_ready events', js: true do

0 commit comments

Comments
 (0)