GfmAutoComplete fetches resources on every project-related view, even when GFM isn't used
Summary
Gitlab.GfmAutoComplete.setup
(responsible for fetching GFM resources and initializing DOM) is called on every project view, even when there's no GFM input in the view. This is unnecessary and contributes to unexpected behavior (e.g. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6054).
Steps to reproduce
Set a breakpoint in GitLab.GfmAutoComplete.setup
(see screenshot below) and navigate on project views (Project, Repository, Activity, etc). New resources will be loaded each time and initialization logic follows.
Expected behavior
It should only be executed on views that require GFM AutoComplete resources.
Actual behaviour
It is executed on every project view, and perhaps more often.
Relevant logs and/or screenshots
Possible fixes
Not sure yet, but here's where to start: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/gfm_auto_complete.js.es6#L50