summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-10-26 17:58:33 +0100
committerPhil Hughes <me@iamphill.com>2017-10-26 17:58:33 +0100
commit3811fbff7a5837bf8c7e2667c1fc1a10ed544e20 (patch)
treec6fa869c6bf3699673a332e0bd786475db344c5b
parent5c0c345a3a8a022b0bfdbab2efd125c42b297373 (diff)
downloadgitlab-ce-3811fbff7a5837bf8c7e2667c1fc1a10ed544e20.tar.gz
reset hash when changing files
[ci skip]
-rw-r--r--app/assets/javascripts/repo/components/repo_preview.vue2
-rw-r--r--app/assets/javascripts/repo/stores/actions/file.js3
2 files changed, 3 insertions, 2 deletions
diff --git a/app/assets/javascripts/repo/components/repo_preview.vue b/app/assets/javascripts/repo/components/repo_preview.vue
index 40c7811523e..bbe5c667254 100644
--- a/app/assets/javascripts/repo/components/repo_preview.vue
+++ b/app/assets/javascripts/repo/components/repo_preview.vue
@@ -15,8 +15,6 @@ export default {
},
mounted() {
this.highlightFile();
-
- // TODO: get this to work across different files
this.lineHighlighter = new LineHighlighter({
fileHolderSelector: '.blob-viewer-container',
scrollFileHolder: true,
diff --git a/app/assets/javascripts/repo/stores/actions/file.js b/app/assets/javascripts/repo/stores/actions/file.js
index eb0aa506d6c..5759ff07aef 100644
--- a/app/assets/javascripts/repo/stores/actions/file.js
+++ b/app/assets/javascripts/repo/stores/actions/file.js
@@ -39,6 +39,9 @@ export const setFileActive = ({ commit, state, getters, dispatch }, file) => {
commit(types.SET_FILE_ACTIVE, { file, active: true });
dispatch('scrollToTab');
+
+ // reset hash for line highlighting
+ location.hash = '';
};
export const getFileData = ({ state, commit, dispatch }, file) => {