Skip to content

Cache (non GQL) API data for Vue MR list filters

What does this MR do and why?

For #491171 (closed)

  1. This adds a small local (frontend) cache to queries that would typically be unchanged in an average user session.
  2. Selects the correct API endpoint when querying for branches
  3. 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

  1. Enable the vue_merge_request_list feature flag ==> rails c, Feature.enable( :vue_merge_request_list )
  2. Visit the MR list page in the GDK, like: https://gdk.test:3443/gitlab-org/gitlab-test/-/merge_requests
  3. (Open the browser console Network tab)
  4. Add a target branch filter
  5. (Optional) Add a source branch filter
  6. Repeat as desired
  7. Note that:
    1. On the first request to either target or source branch, the list is populated with a network request
    2. On subsequent requests to either filter, neither makes a network request, but still shows the same list

Bonus Validation:

  1. 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.
  2. It will be challenging to verify that the update is working as intended except if you:
    1. Load the MR list page
    2. Add a source branch filter so that the expiration is added for the source branch data refresh
    3. Push a new branch and open an MR from that branch
    4. 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

Merge request reports

Loading