At panel can open with results triggered externally from the node it is wrapping #142
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.
In rare cases it's possible to trigger
handleInput
via the watch ofmembers
from a node external to the one wrapped by theAt
instance.The happened in the following scenario:
At
members
pool.members
kicks inrange
inhandleInput
get created but itscommonAncestorContainer
is the text node belonging to the link in the message thread, completely external to theAt
instance@
ie. it is a display of a mention the mention detection based on the range kicks inAt
instance matching valid results and displaying the panel even tho no input was actually entered in the input wrapped by theAt
To resolve this issue the following logic was added
range.commonAncestorContainer
to check it is inside of theAt
instancesthis.$el
if it isn't exit the rest of thehandleInput
functionkeep
is true which is currently only set in the watch as thats the only time it needs to happenIn theory this could happen at any time an update to members occurs and the range gets creating from a node external to the one the instance is wrapping and happens to have a sting containing a mention like pattern.