summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/diffs/components/app.vue
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/diffs/components/app.vue')
-rw-r--r--app/assets/javascripts/diffs/components/app.vue38
1 files changed, 15 insertions, 23 deletions
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue
index 8ea443814e9..c07850b1a4f 100644
--- a/app/assets/javascripts/diffs/components/app.vue
+++ b/app/assets/javascripts/diffs/components/app.vue
@@ -2,7 +2,6 @@
import { mapState, mapGetters, mapActions } from 'vuex';
import { GlLoadingIcon } from '@gitlab/ui';
import Mousetrap from 'mousetrap';
-import Icon from '~/vue_shared/components/icon.vue';
import { __ } from '~/locale';
import createFlash from '~/flash';
import PanelResizer from '~/vue_shared/components/panel_resizer.vue';
@@ -27,7 +26,6 @@ import {
export default {
name: 'DiffsApp',
components: {
- Icon,
CompareVersions,
DiffFile,
NoChanges,
@@ -95,7 +93,6 @@ export default {
parseInt(localStorage.getItem(TREE_LIST_WIDTH_STORAGE_KEY), 10) || INITIAL_TREE_WIDTH;
return {
- assignedDiscussions: false,
treeWidth,
};
},
@@ -114,6 +111,7 @@ export default {
numVisibleFiles: state => state.diffs.size,
plainDiffPath: state => state.diffs.plainDiffPath,
emailPatchPath: state => state.diffs.emailPatchPath,
+ retrievingBatches: state => state.diffs.retrievingBatches,
}),
...mapState('diffs', ['showTreeList', 'isLoading', 'startVersion']),
...mapGetters('diffs', ['isParallelView', 'currentDiffIndex']),
@@ -144,9 +142,6 @@ export default {
isLimitedContainer() {
return !this.showTreeList && !this.isParallelView && !this.isFluidLayout;
},
- shouldSetDiscussions() {
- return this.isNotesFetched && !this.assignedDiscussions && !this.isLoading;
- },
},
watch: {
diffViewType() {
@@ -163,10 +158,8 @@ export default {
},
isLoading: 'adjustView',
showTreeList: 'adjustView',
- shouldSetDiscussions(newVal) {
- if (newVal) {
- this.setDiscussions();
- }
+ retrievingBatches(newVal) {
+ if (!newVal) this.unwatchDiscussions();
},
},
mounted() {
@@ -192,10 +185,14 @@ export default {
},
created() {
this.adjustView();
- eventHub.$once('fetchedNotesData', this.setDiscussions);
eventHub.$once('fetchDiffData', this.fetchData);
eventHub.$on('refetchDiffData', this.refetchDiffData);
this.CENTERED_LIMITED_CONTAINER_CLASSES = CENTERED_LIMITED_CONTAINER_CLASSES;
+
+ this.unwatchDiscussions = this.$watch(
+ () => `${this.diffFiles.length}:${this.$store.state.notes.discussions.length}`,
+ () => this.setDiscussions(),
+ );
},
beforeDestroy() {
eventHub.$off('fetchDiffData', this.fetchData);
@@ -217,7 +214,6 @@ export default {
'toggleShowTreeList',
]),
refetchDiffData() {
- this.assignedDiscussions = false;
this.fetchData(false);
},
startDiffRendering() {
@@ -269,17 +265,13 @@ export default {
}
},
setDiscussions() {
- if (this.shouldSetDiscussions) {
- this.assignedDiscussions = true;
-
- requestIdleCallback(
- () =>
- this.assignDiscussionsToDiff()
- .then(this.$nextTick)
- .then(this.startTaskList),
- { timeout: 1000 },
- );
- }
+ requestIdleCallback(
+ () =>
+ this.assignDiscussionsToDiff()
+ .then(this.$nextTick)
+ .then(this.startTaskList),
+ { timeout: 1000 },
+ );
},
adjustView() {
if (this.shouldShow) {