Hide homepage count cards behind the merge requests widget flag

What does this MR do and why?

The personal homepage displays four small count cards in the left column: "Merge requests / Waiting for your review", "Merge requests / Assigned to you", "Work items / Assigned to you", and "Work items / Authored by you". This MR hides all four cards when the homepage_merge_requests_widget feature flag is enabled, because the new merge requests widget is designed to replace them.

The problem this fixes: until now the cards rendered unconditionally, so users with the flag enabled saw both the widget and the two merge request cards side by side, reporting different numbers for the same work, because the widget counts authored merge requests in addition to assigned ones.

The approach: gating both the card visibility and the queries that feed them on a single flag ensures every user is in exactly one coherent state, and keeps the rollout instantly reversible. The feature flag is default off and it has never been enabled in production yet.

Flag Left column cards Right sidebar widget
off (default) four count cards no widget
on no cards merge requests widget

Implementation details:

  • The two GraphQL queries that exist only to serve the four cards are now skipped under the same condition, so they no longer execute on every page load when there is nothing to render them into.
  • The flag is disabled by default, so the default experience is unchanged and no changelog entry is required.

Note: The second commit in this MR is unrelated to the cards. The merge requests widget's tab bar had a stray vertical scrollbar because overflow-x: auto makes the vertical overflow compute to auto as well per the CSS overflow specification. This is a one-line fix included here for convenience rather than filed as a separate MR.

References

The feature flag remains type: wip for now. A follow-up MR will transition it to gitlab_com_derisk with a rollout issue before it is enabled on gitlab.com. A final MR will remove the flag and the now-unreachable card code after the rollout is complete.

Screenshots or screen recordings

Feature flag disabled Feature flag enabled
image.png image.png

How to set up and validate locally

  1. Enable the flag for your user in a Rails console with Feature.enable(:homepage_merge_requests_widget, User.find_by_username('root')), then visit / and confirm the four count cards are gone and only the widget appears.
  2. Disable it again with Feature.disable(:homepage_merge_requests_widget), then visit / and confirm the four count cards are back and the widget is gone.
  3. With the flag enabled, check the browser network tab and confirm no request is made for the two metadata queries that previously fed the cards.
  4. Verify that both / and /dashboard/home render the same page and behave correctly in both cases.
Edited by Marco Tomasi

Merge request reports

Loading
Loading