Fix bug when mutation causes controller to be registered twice #97
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Partially reverts 67e2cf3#diff-8e0a8f9875453f690405e8c037a8e76c4436f09f47fd9c605283c2f16bd95789L77
Resolves an issue where a controller is registered twice.
I created a sample Rails app to reproduce this issue. Relevant commit: lewispb/stimulus-loader-issue@ce8aaa5
To reproduce:
Before
The first inserted element is removed as the disconnect function is immediately called. In our application this is a flash message.
before.mov
After
Elements are removed correctly, after the timeout.
after.mov