From 3811fbff7a5837bf8c7e2667c1fc1a10ed544e20 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 26 Oct 2017 17:58:33 +0100 Subject: reset hash when changing files [ci skip] --- app/assets/javascripts/repo/components/repo_preview.vue | 2 -- app/assets/javascripts/repo/stores/actions/file.js | 3 +++ 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) => { -- cgit v1.2.1