User autocompleter keeps trying to match when it shouldn't, slows-down the editor #30640
Labels
[Package] Components
/packages/components
[Package] Editor
/packages/editor
[Type] Bug
An existing feature does not function as intended
Description
Related to the changes in #29939, which are somewhat incompatible with the UX for the user autocomplete.
Its triggers can happen anywhere and stay on the editor even after the completion is done. Once the autocompleter finds the trigger, it runs through its matching/querying algorithm, but then doesn't know when to stop. What happens is that the text after the trigger starts being considered as part of the text to match and it goes up to infinity.
Step-by-step reproduction instructions
user
autocompleter by writing@
on the page;@
and won't know where to stop. Keep writing for a while. How long it takes for the slow-down to take place will depend on your browser, computer spec, and how many users you have in your instance (which influences the query);console.debug( match[1] )
here, open the console, and watch as the autocomplete just tries to match anything after@
greedily, even after a selection has already been done.Expected behaviour
The
user
autocompleter doesn't try to match/query ad-infinitum and doesn't cause the editor's UI to become slow to respond.Actual behaviour
The
user
autocompleter tries to match/query ad-infinitum even after a mismatch.Screenshots or screen recording (optional)
The output in the console refers to the logging of the
match
const as I described in step 4 above. You can see that it continues to grow after the trigger and gradually starts to cause some slow-down (which might not be too visible in this video, but it was there):Peek.2021-04-08.18-14.mp4
WordPress information
Device information
The text was updated successfully, but these errors were encountered: