Global search modal can duplicate search results
Summary
If you type a query into the global search modal at just the right speed, search results can be duplicated.
Steps to reproduce
- Disable browser cache using dev tools (it's easier to reproduce if the network response isn't near-instant)
- Open the global search modal by clicking
Search or go to...
or pressing / - Type a query one character at a time at about the same rate as the request/response cycle
- Observe duplicate entries
Example Project
As a member of the gitlab-org
group, type roule
first, and then slowly type tte
.
What is the current bug behavior?
Matching projects (and possibly users/other results?) get duplicated.
What is the expected correct behavior?
Results should not be duplicated.
Relevant logs and/or screenshots
simplescreenrecorder-2023-09-13_12.21.21
Output of checks
This bug happens on GitLab.com
Possible fixes
- Enhance the typing debounce to cancel previous requests
- Deduplicate response entries by
id
? - Replace instead of append the new data instead.
Edited by Mark Florian