How about the following improvement:
1. when user types @ and starts to type other characters we can remember the first string after @ which means no matching. Then just by checking startsWith() on the client side we can avoid querying the server (when current "mention string" starts with our minimal string which did not find any matching (obviously longer mention string cannot be matched to anything if the shorter string which constitutes the beginning of this longer string also has no matching). If the user deletes part of this "mention string", then as soon as it does not startsWith() our minimal (not matching) string, then we can resume querying the server.
2. related improvement - how about adding a heuristics which would help us to leave mention mode if we detect that the user actually does not seem to be looking for a name. In this case if our current "mention string" does not startsWith() the minimal not matching string and the user typed space or, say, 3 more characters, then we could effectively leave "mention" mode - equivalent to hitting ESC.
Example: say we have just one user "Admin".
1. The user types @adm
2. mention dropdown is shown proposing "Admin" user
3. The user ignores this proposal and continues typing, adding "x" (so we have @admx)
4. admx has not matching user - this is our "minimal not matching string"
5. if now the user continues typing, say by adding "yz", so that we have @admxyz we are not querying the server, as "admxyz" (our current mention string) startsWith("admx")
6. with my suggested improvement, when now the user types space (so that we have "@admxyz "), then we automatically leave mention mode (like pressing Esc).
rkrishna, brollins - what do you think? Let us know, as we would like to fix this problem asap.
Your example looks good to me.
Can you confirm that the matching is done on username AND full name.
Here is my example: Bryan Rollins - brollins
mentions should work for all of these and not just the username