I ran into a similar issue with a similar use case. Although in my case the form was inside a turbo frame, the cause is the same I think: data-turbo-permanent
only works if it is present in both versions of the HTML, the one being displayed and the one replacing it. I’ve solved it for me with a hack: copy the data-turbo-permanent
before the content is replaced, described in detail here: Form that changes on user input without losing focus