Skip to content

Remove expensive zero-issue count from Group Issue List

Summary

Visiting a group issues list, such as https://gitlab.com/groups/gitlab-org/-/issues, performs an expensive count of all issues just to check if an empty state should be shown. This takes a 1000ms or more for gitlab-org.

This count is repeated for the issue numbers in Open/Closed/All tabs.

image

The code doing this check app/views/groups/issues.html.haml#L8:

- if group_issues_count(state: 'all') == 0
  = render 'shared/empty_states/issues', project_select_button: true
- else
  .top-area
    = render 'shared/issuable/nav', type: :issues

@egrieff discovered this as part of her investigation into cacheable issue counts #243753 (closed).

Proposal

  • Reuse a single count for both the tabs and the empty state check.
  • Consider caching this count, or reusing the sidebar cache number.
Edited by John Hope