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

turbo:load does not almost ever trigger on page load when using Firefox #286

Closed
jarmo opened this issue Dec 19, 2021 · 7 comments
Closed

Comments

@jarmo
Copy link

jarmo commented Dec 19, 2021

I tried to use Rails 7 and wrote code like this in one of my view template:

<script>
document.addEventListener("turbo:load", () => alert("foo"))
</script>

It does work every time on Chrome/Edge on Windows when pressing refresh in the browser, however when I use Firefox then it does trigger only very rarely.

I found an issue guybedford/es-module-shims#161 which seems to be the exact problem I'm having, but I would expect that this is long time ago fixed already since I'm using Rails 7.0.0.

Any ideas why it does not work?

@jarmo jarmo changed the title turbo:load does not almost never trigger on page load when using Firefox turbo:load does not almost ever trigger on page load when using Firefox Dec 19, 2021
@denschub
Copy link

denschub commented May 5, 2022

I found this issue by looking into why a larger app breaks for me. Sadly, while trying to build an isolated test case, I failed, and it worked every time. @jarmo, did you succeed building a simple testcase for that?

@denschub
Copy link

denschub commented May 6, 2022

Note: This issue also affects Safari 15.4

@jarmo
Copy link
Author

jarmo commented May 6, 2022

@denschub it was a pretty barebones Rails app at the time, which I still had on my disk, but when trying again it now then this problem does not occur anymore at all. Maybe it's also Firefox version related?

@denschub
Copy link

denschub commented May 6, 2022

It's not related to any Firefox version, sadly. I'm starting to have a fairly good understanding (see the other bug I linked), but I have to dig a bit more into that... I have a hunch of what it might be, but I have to validate that first.

@jarmo
Copy link
Author

jarmo commented May 6, 2022

I'm just confused as to why it does not happen anymore for me with the same codebase on the same PC using Firefox. Only thing I can think of is that some time has passed and things might have changed with Firefox. At the time of reporting this issue I almost never managed to get turbo:load to fire, but now it seems to fire every time. I did not update any gems or anything.

@jarmo
Copy link
Author

jarmo commented May 6, 2022

Okay, refreshed my page like 50 times and managed to reproduce it only one time (which is also bad of course).

@dhh
Copy link
Member

dhh commented May 22, 2022

Solved in https://github.com/rails/importmap-rails/releases/tag/v1.1.0

@dhh dhh closed this as completed May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants