I might be misunderstanding the issue, but would turbo & turbo frame tags be the best solution here? When you have a form object and you're submitting the form, I don't think that the Rails controller can respond with a new form for the task like you're doing in the update. (at least not with how you have it setup like that).
Are you trying to do something like nested forms? Once the user uploads a document, you want it to add a new field where they can select an additional document? If this is the case, it may be better to use a Stimulus controller. This episode may help. https://www.driftingruby.com/episodes/nested-forms-from-scratch-with-stimulusjs
Good call Hussein . I didn't even realize that I had this installed. Not sure if it was from a previous library or dependency, but thanks for posting that!