"Filter by name" field should not execute filter when filter text has not changed
Summary
Currently, it would appear that the "Filter by name" field executes a filter (after a debounce interval) when any key is pressed, including keys that do not have any effect on the input.
Steps to reproduce
- Go to https://gitlab.com/gitlab-org/gitlab-ce/issues
- Focus the Filter by name field and press an arrow key
- Observe that the UI dims, indicating a new request has been sent (you can also confirm this in the Network tab in browsers' developer tools)
Expected behavior
A request should only be fired in response to an actual change to text in the input field.
Possible fixes
Consider listening to the input
event instead of keydown
or keyup
; AFAIK it is supported by all browsers that GitLab supports.
I've currently spotted the following cases where this applies:
- Issues: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/issues.js.coffee#L42
- Merge requests: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/merge_requests.js.coffee#L11
- Projects list: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/projects_list.js.coffee#L7