Safari back button won't trigger connect()

I’ve been searching this issue but haven’t found any solution so far. Probably I’m doing something stupid but can’t seem to find what I’m doing wrong.

I’ve implemented Stripe.js on a stimulus controller. I call an action on the submit button that does event.preventDefault();, then it does all the Stripe checks and after the last step it does a this.element.submit() (POST to a rails controller with a redirect to another page).

This is working fine but when I click the back button on Safari the form is stuck in an inconsistent state. I notice when clicking back Safari is not doing a request at all at the server unlike Firefox which it does and it is also not triggering the connect() from stimulus which is the reason the form remains inconsistent (the cached version of stripe.js seems to have lost its authentication).

Is there anything that can be done besides reloading the whole page? I won’t think that hitting back and not connecting again to stimulus is a normal behavior or otherwise this would fundamentally degrade the whole purpose of stimulus.

Perhaps a stupid answer. But, have you tried clicking the submit button instead? What does the connect do?