Set Cache-Control for autocomplete_sources
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
- Open an issue or MR with Network Dev tools open
- Start typing
/
in the comment box - Ensure that the
autocomplete_sources
response wasn't served from cache - Open a new page with the same URL
- Start typing
/
in the comment box - Ensure that the response wasn't served from cache
- Execute
Feature.enable(:cache_autocomplete_sources_commands)
- Repeat the steps above, but this time the second time you should see a cached response
- Repeat the steps above for
/labels
command withcache_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.
-
I have evaluated the MR acceptance checklist for this MR.