Open
Description
I think there's bug when using in a form with multiple nested associations. Like a Survey -> Questions -> Answers situation for example.
When clicking Remove the code here https://github.com/stimulus-components/stimulus-rails-nested-form/blob/master/src/index.ts#L34 will grab the first _destroy input which in a double nested situation might be wrong (depends on where you put the remove button) and you'll end up removing a nested child instead of the parent child sometimes.
If the line instead is written like
const input = wrapper.querySelector(":scope > input[name*='_destroy']")
everything works but the precludes that the input element is a direct descendent of the wrapper class. Not sure what the ideal fix would be.
Metadata
Metadata
Assignees
Labels
No labels