Rails 6.1, Stimulus 2 + Turbo.
I have a scenario where a user is presented with a form to update their account. When they submit the update, there is a potentially long-running process to a third-party API spawned off in ActiveJob. One of these API calls could generate an error, which I’d want to send back to the user to correct. I don’t have a way to validate the error locally, it must go to the API to find out if it’s good or not.
Right now, I feel like the form submission should complete successfully, return a view that’s a progress indicator of some kind, and use a turbo_stream to display the edit form if an error comes up, but I’m not even sure exactly how I’d do that.
Is there an easier way? If not, how would I indicate in a turbo_stream that I need to display the edit form with errors from the ActiveJob process?