Use cached issue and MR counts for milestone pages
Summary
While investigating #7302 I discovered that issue and merge request counts on the milestone page were querying the database instead of using values stored in cache. For example: https://gitlab.com/gitlab-org/gitlab/blob/b36db1578ddf8ecf7da913e192dd485c4907b3df/app/views/shared/milestones/_sidebar.html.haml#L89
This is in contrast to the milestone issues list, which uses cached values. For example:
- https://gitlab.com/gitlab-org/gitlab/blob/8a5aa52813b8aa54ea3de2a860dc853038fac616/app/views/shared/issuable/_nav.html.haml#L8
- https://gitlab.com/gitlab-org/gitlab/blob/99f65fd5da7260492f7410f5ab8d716007fe06c2/app/helpers/issuables_helper.rb#L313
Improvements
- I believe we'll see a performance improvement for initial page render after implementing this
- As a bonus, the sidebar counts will now match the issues list counts
Risks
Involved components
In addition to the files above, likely the milestones controller. I get the sense we'll have to change the helper and its memoization strategy above so that it can be reused in the same page for both MRs and issues.