Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
charlesobrien opened this issue Apr 27, 2024 · 4 comments

Comments

@charlesobrien
Copy link

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
Copy link

joshuay03 commented Apr 28, 2024

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 hotwired/turbo#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
Copy link
Author

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

@PabloScolpino
Copy link

Apologies if this is self-evident and I'm not seeing the solution.

What is the intended fix for this? If any.
OR, do you ppl have a suggested workaround?

Thanks

@joshuay03
Copy link

joshuay03 commented Sep 7, 2024

What is the intended fix for this? If any. OR, do you ppl have a suggested workaround?

I think we can try removing the async from the mini-profiler script? My understanding is that it should be executed first cause it's blocking. Could you give that a go?

Edit: Tried this, didn't work. Hopefully someone who's more JS savvy can chime in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants