Cache (non GQL) API data for Vue MR list filters
What does this MR do and why?
For #491171 (closed)
- This adds a small local (frontend) cache to queries that would typically be unchanged in an average user session.
- Inspired by the Issues list AutocompleteCache.
- Expands by allowing manual updates
- Expands by allowing input mutators and output formatters
- Selects the correct API endpoint when querying for branches
- Adds a cache expiration time limit so that - periodically - the user will still get fresh data
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
N/A this is all backstage
How to set up and validate locally
- Enable the
vue_merge_request_list
feature flag ==>rails c
,Feature.enable( :vue_merge_request_list )
- Visit the MR list page in the GDK, like:
https://gdk.test:3443/gitlab-org/gitlab-test/-/merge_requests
- (Open the browser console Network tab)
- Add a target branch filter
- (Optional) Add a source branch filter
- Repeat as desired
- Note that:
- On the first request to either target or source branch, the list is populated with a network request
- On subsequent requests to either filter, neither makes a network request, but still shows the same list
Bonus Validation:
- Change the
BRANCH_LIST_REFRESH_INTERVAL
value to be very short and watch it update in the background when the source/target branch list is opened. - It will be challenging to verify that the update is working as intended except if you:
- Load the MR list page
- Add a source branch filter so that the expiration is added for the source branch data refresh
- Push a new branch and open an MR from that branch
- Re-open the source branch filter and note that your new branch is in the list after a network request backfills it
- You may need to open the source branch filter twice: once to trigger the update network request, and the second time to actually see the new content - if it doesn't pop-in automatically.
Edited by Thomas Randolph