MiniProfiler / rack-mini-profiler

Profiler for your development and production Ruby rack apps.
MIT License
3.68k stars 400 forks source link

Badge no longer displays after Turbo Drive page load w/ Turbo 8 (even w/ enable_hotwire_turbo_drive_support = true) #612

Open charlesobrien opened 2 months ago

charlesobrien commented 2 months ago

Issue: After upgrading to Turbo 8 the Rack Mini Profiler badge no longer displays after a Turbo Drive action with Rack::MiniProfiler.config.enable_hotwire_turbo_drive_support = true. If I revert back to Turbo 7 / Turbo Rails 1.5 the behavior works as expected.

Expected Behavior: When a page loads with Turbo Drive the Rack Mini Profiler badge displays.

Actual Behavior: When a page loads with Turbo Drive the Rack Mini Profiler badge does not display.

joshuay03 commented 2 months ago

I dug into this a bit cause it's affecting our app as well.

From what I can tell, Turbo 8 references and uses the native window.fetch function for its requests (added in https://github.com/hotwired/turbo/pull/1019). As a result, this override is never utilised by Turbo Drive because the Turbo scripts are preloaded before the profiler script is executed:

Screenshot 2024-04-28 at 9 51 55 PM Screenshot 2024-04-28 at 9 48 32 PM
charlesobrien commented 2 months ago

@joshuay03 Thanks for sharing! My spelunking was leaving me stumped.