Skip to content

Super Sidebar: Move user count management to a shared state

Lukas Eipert requested to merge leipert-user-count-manager into master

What does this MR do and why?

Super Sidebar: Move formatting to counter

Instead of formatting only todos, we move the 100 => 99+ formatting to the counter component. This will enable us to update other counts more easily as well.

Super Sidebar: Move user count management to a shared state

This moves the User Count management to a shared state, this enables us to do the following:

  1. Trigger User Counts refreshes via APi from elsewhere in the app, after certain actions.
  2. Broadcast User Counts across tabs. If you switch tabs, you will see the most recent User Count numbers in any GitLab tab.
  3. If you navigate to a new GitLab page, this will broadcast the current count to all other open tabs, updating them.

We had a similar solution for Merge Request counts already, this generalizes this isolution solution and makes it available in the new Super Sidebar navigation.

Note: This currently doesn't touch the todo:toggle events. This will be dealt with in a follow-up because some todo:toggle events are optimistic updates, e.g. changing the counter before any API call happened and some events happen after an API has been made. Untangling this should happen in a different commit.

Fixes: #407845 (closed)

Changelog: changed

Super Sidebar: Use shared User Counts in MR menu

This makes us utilize the new shared user counts in the super sidebar MR menu, so that updates to the counts are reflected there as well.

Screenshots or screen recordings

Screen_Recording_2023-05-02_at_15.13.20

Note:

  • Certain issue actions (e.g. closing issues) are not triggering a re-fetch, while MR actions do that. Porting that cababilities to the issue actions is outside the scope for this MR.
  • Todo increment/decrement changes are out of scope for this MR.
  • This MR mainly brings feature parity with what we currently have in the old nav PLUS the syncing of counts across tabs on-load.

How to set up and validate locally

  1. Enable the super_sidebar_nav feature flag.
  2. Log into the GDK and enable the New Navigation for the current user via the User Menu
  3. Create some todos, by assigning issues, unassigning issues while multiple tabs are open. Change the todo count in your current tab and switch to a new tab.

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 Lukas Eipert

Merge request reports

Loading