Ran into a bit of a problem listening to submit-start
and submit-end
doing something like so:
document.addEventListener('turbo:submit-start', () => {
Turbo.navigator.delegate.adapter.showProgressBar();
})
document.addEventListener('turbo:submit-end', (e) => {
Turbo.navigator.delegate.adapter.progressBar.hide();
if (e.detail.success === false) {
e.target.previousElementSibling.scrollIntoView(true)
}
})
In particular, turbo:submit-end
doesn’t seem to reliably fire on Safari 14.0.3 for me, despite the fetch request happening. It seems happy in Chrome. I do have rails_ujs installed, but disabled on forms.
If I wrap the form in a turbo frame, the event reliably fires but Rails is giving me a 302 back, not a 303, so the success condition doesn’t redirect…
This is 7.0.0-beta.3 and turbo-rails 0.5.7.