I just encountered a strange behaviour in my current RoR web app: every time I use the browser's back button (multiple browsers tested, safe mode included), the GET request is being sent multiple times, duplicated. Sometimes twice, but up to 5 times in a row in under 3 seconds. This also causes the SQL queries to run multiple times, doing the same thing. If I use links to go back, or paste URLs to access the previous page, this does not happen. Did anyone encounter this, or know what could cause it?
Thanks for your help!
Best,
Alex
Although I've found this to be caused by other issues, the main cuprit is Turbolinks
.
Basically, Turbolinks loads the body
of your new view via ajax, instead of pulling the whole page (it's meant to speed up the application in production).
It's often the case that Turbolinks will cause issues such as duplicate requests when pressing the back
button etc... although to get it with every browser is very strange.
--
Due to a lack of code, I can only speculate on this issue.
It's probably wrong, but a good test to see if it replicates is to remove the references to turbolinks
in your JS files; specifically:
#app/assets/javascripts/application.js
//= require turbolinks <- remove this line and see if it fixes the issue
I'll happily delete the answer if it's inappropriate. You'd be best putting up a public repo so that people can see what infrastructure you have.