Skip to content

Branches selector is loaded synchronously and twice on commits page

If you (for some reason) have a few thousand branches, you're loading every single one twice to display the commit page:

Screen_Shot_2016-07-21_at_3.50.23_PM

For example, see https://gitlab.com/gitlab-org/gitlab-ce/commit/ab811b6ab929d3f220e060c15c49bc075d91e5f2.

Screen_Shot_2016-07-21_at_4.05.54_PM

For GitLab CE, 390 branches * 2 dropdowns = 780 options that need to be rendered, that's quite a few.

That's bad for performance both backend and frontend, especially since these are loaded for the cherry pick and revert dialogs, two dialogs which are used on <1% of page loads (good features, just not frequently used features!).

We should load the branches data asynchronously - only when the branch selector is actually opened - like in !4508 (merged).

@iamphill would it be possible to make a helper for branches/tags dropdowns since we currently use them in a few different places? Maybe with the ability to pass branches, tags, or branches_and_tags into it depending on what's necessary?

cc: @lbennett @alfredo1