Closed Napokue closed 1 year ago
Thank you for pointing that out.
It was a little too ambitious of me to think that such a naïve implementation would suffice. I have revisited it and also used your feedback to come up with another, more complex solution that will solve the issue and even minimize the API requests more.
What I did come up with was to introduce the following:
Test
, which will send an API request and after that continue their search with: Test User
without sending a new API request. If the user now decides to search for Test account
it will still not send an API request, only when the user presses backspace and the new search will be Tes
for instance.Please let me know what you think of this implementation and if it is something we want.
Great, thanks for pointing out those two points.
One character name search - Should probably fix
Agreed, I was not aware of one character users. Only checked a-z. Will do a little testing for this, but should not be a problem to change.
Typeahead cache doesn't reset if selecting all characters in search box and immediately typing a new username
Good point! I have not considered that usecase. Is not too hard to fix, we could probably implement a check that checks if the first character of the "new" search query is equal to the first character of the old search query.
After coming back after a couple of days I was able to view this issue from another perspective and simplified my initial rather complex proposal with a much (in my opinion) better implementation.
I also took the time to optimize the filterTypeahead
function, it will not filter through the whole cache now to only get the first 5 results. Worst case scenario, it will iterate through the whole cache if the last 5 elements are matching the filter.
As discussed in #53 a possible way to prevent a user to navigate to a collection log that does not exist.