🐛 Treating synthetic PointerEvent
on removeVanillaNestedFields
#61
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.
Hi there 👋
This is a great library, thanks for maintaining it!
I faced the same issue as #47 when using
vanilla-nested
with Turbo, and pointing my gem to themain
branch of the repo solved it (kudos for the fix).However, it seems that the changes here introduced a edge-case error that I could trace to
removeVanillaNestedFields
receiving a syntheticPointerEvent
instead of the expectedelement
directly, under some circumstances. I added a small conditional with this PR to deal with both cases.It seems that the synthetic event is only sent when removing nested fields added by clicking on the link generated by
link_to_add_nested
.This may not be the best fix (and I may not understand the underlying reason this is happening), but I thought I'd send this PR and document the fix and the error anyway.
Tested on Chrome.
Thanks!