Skip to content

Set Cache-Control for autocomplete_sources

Dmitry Gruzd requested to merge set-cache-control-for-autocomplete-sources into master

What does this MR do and why?

This is a follow-up to Set Cache-Control for autocomplete_sources/members (!133454 - merged)

I've extracted the cache logic to a module so that we can have it in one place and added frontend caching for commands and labels actions behind their respective feature flags.

I believe that caching of these 3 actions will greatly improve UX and GitLab will feel a lot faster.

I've opened Preload autocomplete_sources/members (#427437 - closed) for members, but we can apply the same approach for other actions and caching will be quite beneficial.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Open an issue or MR with Network Dev tools open
  2. Start typing / in the comment box
  3. Ensure that the autocomplete_sources response wasn't served from cache
  4. Open a new page with the same URL
  5. Start typing / in the comment box
  6. Ensure that the response wasn't served from cache
  7. Execute Feature.enable(:cache_autocomplete_sources_commands)
  8. Repeat the steps above, but this time the second time you should see a cached response
  9. Repeat the steps above for /labels command with cache_autocomplete_sources_labels feature flag

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Dmitry Gruzd

Merge request reports