diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-07 15:10:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-07 15:10:00 +0300 |
commit | 100b1a03e603487ff1966f513ba1a177a8adaefd (patch) | |
tree | fb9ffa9c0e2351d822dce1d122275c72cdc46805 /app/assets/javascripts/diffs | |
parent | 5b6e9de025786e5f46443d408f1eeadb8e8b4f7b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/diffs')
-rw-r--r-- | app/assets/javascripts/diffs/components/app.vue | 21 | ||||
-rw-r--r-- | app/assets/javascripts/diffs/store/actions.js | 3 |
2 files changed, 14 insertions, 10 deletions
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index 731050f2e51..7827c78b658 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -283,10 +283,7 @@ export default { }, created() { this.adjustView(); - - notesEventHub.$once('fetchDiffData', this.fetchData); - notesEventHub.$on('refetchDiffData', this.refetchDiffData); - eventHub.$on(EVT_VIEW_FILE_BY_FILE, this.fileByFileListener); + this.subscribeToEvents(); this.CENTERED_LIMITED_CONTAINER_CLASSES = CENTERED_LIMITED_CONTAINER_CLASSES; @@ -307,11 +304,7 @@ export default { }, beforeDestroy() { diffsApp.deinstrument(); - - eventHub.$off(EVT_VIEW_FILE_BY_FILE, this.fileByFileListener); - notesEventHub.$off('refetchDiffData', this.refetchDiffData); - notesEventHub.$off('fetchDiffData', this.fetchData); - + this.unsubscribeFromEvents(); this.removeEventListeners(); }, methods: { @@ -331,6 +324,16 @@ export default { 'navigateToDiffFileIndex', 'setFileByFile', ]), + subscribeToEvents() { + notesEventHub.$once('fetchDiffData', this.fetchData); + notesEventHub.$on('refetchDiffData', this.refetchDiffData); + eventHub.$on(EVT_VIEW_FILE_BY_FILE, this.fileByFileListener); + }, + unsubscribeFromEvents() { + eventHub.$off(EVT_VIEW_FILE_BY_FILE, this.fileByFileListener); + notesEventHub.$off('refetchDiffData', this.refetchDiffData); + notesEventHub.$off('fetchDiffData', this.fetchData); + }, fileByFileListener({ setting } = {}) { this.setFileByFile({ fileByFile: setting }); }, diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index e7f950f15c1..ee319990290 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -114,7 +114,8 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { } if ( - (diffsGradualLoad && totalLoaded === pagination.total_pages) || + (diffsGradualLoad && + (totalLoaded === pagination.total_pages || pagination.total_pages === null)) || (!diffsGradualLoad && !pagination.next_page) ) { commit(types.SET_RETRIEVING_BATCHES, false); |