Skip to content

Lazily Load Autocomplete Info

username-removed-400715 requested to merge asuper/gitlab-ce:master into master

What does this MR do?

This patch changes the code to lazily load the autocomplete info when the user clicks in a comment box, as opposed to after a 1-second timeout.

Why was this MR needed?

Currently, the code sets a timeout of one second before performing the fetch from the data source. As far as I can tell, this is to ensure that the data source variable is correctly set, as it has the potential to be set twice by inline JS on pages with comment boxes.

By fetching the necessary data when the user actually clicks in the comment boxes, we can eliminate many requests caused by people viewing issue pages, but not commenting. It also negates the need for a one-second delay, as the @dataSource variable will be properly set by the time a user can click in a comment box.

Are there points in the code the reviewer needs to double check?

I do not believe so. I tested the change on several pages on my development version and everything worked as expected.

What are the relevant issue numbers?

None applicable on this repository, but this is a small piece to help with issue 42 in operations.

Merge request reports