diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-10-04 17:22:07 +0200 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-10-04 17:27:56 +0200 |
commit | 8d14a95638d7d6b52254b192b3e54296e22fddc3 (patch) | |
tree | 3dbd81575e6643a9b40ee9a4c583467747a5e21e | |
parent | 0a671c8223d7fab14acdb40d30a7a74696885d75 (diff) | |
download | gitlab-ce-8d14a95638d7d6b52254b192b3e54296e22fddc3.tar.gz |
Optimising If
-rw-r--r-- | app/assets/javascripts/repo/components/repo_sidebar.vue | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/assets/javascripts/repo/components/repo_sidebar.vue b/app/assets/javascripts/repo/components/repo_sidebar.vue index 0e6acf96836..9f58f63b850 100644 --- a/app/assets/javascripts/repo/components/repo_sidebar.vue +++ b/app/assets/javascripts/repo/components/repo_sidebar.vue @@ -42,8 +42,8 @@ export default { const lineNumber = Number(location.hash.substr(2)); if (!isNaN(lineNumber)) { Store.setActiveLine(lineNumber); - if (Store.isPreviewView()) { - if (document.getElementById(`L${lineNumber}`)) document.getElementById(`L${lineNumber}`).scrollIntoView(); + if (Store.isPreviewView() && document.getElementById(`L${lineNumber}`)) { + document.getElementById(`L${lineNumber}`).scrollIntoView(); } else { Helper.monacoInstance.setPosition({ lineNumber: this.activeLine, |