Skip to content

Show frequently used items in the context switcher

What does this MR do and why?

This leverages the existing local storage keys to populate the context switcher with frequently used items.

This is the first MR for #378541 (closed). This does not yet touch the Switch to... section or the search functionality. We are only focusing on rendering existing cached items within their respective sections, and applying the correct styling to both lists.

Screenshots or screen recordings

Context Preview
With cached items Screenshot_2023-03-03_at_3.43.47_PM
Without cached items Screenshot_2023-03-03_at_3.44.48_PM

How to set up and validate locally

  1. Make sure you already have cached frequent items before enabling the new sidebar.
    • The reason is that the logic for incrementing the items' access counters lives within the existing "context switcher", which is being hidden when enabling the super sidebar. We will need to backport that functionality in a follow-up.
  2. To enable the new nav:
    1. Enable the feature flag:

      echo "Feature.enable(:super_sidebar_nav)" | rails c
    2. Enable the user setting from the user dropdown:

      Screenshot_2022-12-13_at_1.32.43_PM

  3. Frequent items should now show up within the context switcher.
  4. To test the empty states, rename or delete the following keys from your local storage, replacing <username> with your username:
    • <username>/frequent-projects
    • <username>/frequent-groups

MR acceptance checklist

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

Related to #378541 (closed)

Merge request reports