From 79648c58d0e59728a440e7fa70a1a4653f1a29ab Mon Sep 17 00:00:00 2001 From: Mitsuhiro Shibuya Date: Sun, 6 Oct 2024 18:32:59 +0900 Subject: [PATCH] Disable Turbo's prefetch, which became the default in turbo-rails 2.x --- app/views/layouts/rails_admin/_head.html.erb | 1 + spec/integration/rails_admin_spec.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/app/views/layouts/rails_admin/_head.html.erb b/app/views/layouts/rails_admin/_head.html.erb index d78e4366f..43ce0096d 100644 --- a/app/views/layouts/rails_admin/_head.html.erb +++ b/app/views/layouts/rails_admin/_head.html.erb @@ -2,6 +2,7 @@ + <%= csrf_meta_tag %> <% case RailsAdmin::config.asset_source when :webpacker %> diff --git a/spec/integration/rails_admin_spec.rb b/spec/integration/rails_admin_spec.rb index 8040dcc82..26bb603f6 100644 --- a/spec/integration/rails_admin_spec.rb +++ b/spec/integration/rails_admin_spec.rb @@ -204,6 +204,13 @@ is_expected.to have_content 'Player failed to be updated' is_expected.to have_css '.filtering-select[data-input-for="player_team_id"]' end + + it 'does not prefetch pages' do + allow_any_instance_of(RailsAdmin::Config::Actions::Index).to receive(:controller).and_raise('index prefetched') + visit dashboard_path + find('.sidebar a.nav-link[href$="/player"]').hover + sleep 0.3 # Turbo waits 100ms before prefetch + end end describe 'dom_ready events', js: true do