Great write-up. This is common use case which I'm running into frequently myself. Recently, I started using an alternative approach with a spinner which avoids touching a stimulus controller to create the intended behaviour.
It requires to create a partial for the spinner SVG including a text variable and swapping f.submit events for f.button. It's fast, minimal overhead and reproducable. The only concern I have is if swapping the submit event for a button has other, unintended consequences. Love to hear your thoughts on this approach.
Very cool! How does this circumvent the use of a Stimulus controller though? I suppose it could just use UJS, but UJS being deprecated is why I wrote this up in the first place.
Great write-up. This is common use case which I'm running into frequently myself. Recently, I started using an alternative approach with a spinner which avoids touching a stimulus controller to create the intended behaviour.
It requires to create a partial for the spinner SVG including a text variable and swapping f.submit events for f.button. It's fast, minimal overhead and reproducable. The only concern I have is if swapping the submit event for a button has other, unintended consequences. Love to hear your thoughts on this approach.
Very cool! How does this circumvent the use of a Stimulus controller though? I suppose it could just use UJS, but UJS being deprecated is why I wrote this up in the first place.
Oh, okay.. I'm using UJS indeed for this.