Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/diffs/components/app.vue')
-rw-r--r--app/assets/javascripts/diffs/components/app.vue31
1 files changed, 20 insertions, 11 deletions
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue
index 8039a9a7602..beda1a0dc14 100644
--- a/app/assets/javascripts/diffs/components/app.vue
+++ b/app/assets/javascripts/diffs/components/app.vue
@@ -144,6 +144,9 @@ export default {
isLimitedContainer() {
return !this.showTreeList && !this.isParallelView && !this.isFluidLayout;
},
+ shouldSetDiscussions() {
+ return this.isNotesFetched && !this.assignedDiscussions && !this.isLoading;
+ },
},
watch: {
diffViewType() {
@@ -160,6 +163,11 @@ export default {
},
isLoading: 'adjustView',
showTreeList: 'adjustView',
+ shouldSetDiscussions(newVal) {
+ if (newVal) {
+ this.setDiscussions();
+ }
+ },
},
mounted() {
this.setBaseConfig({
@@ -214,26 +222,28 @@ export default {
isLatestVersion() {
return window.location.search.indexOf('diff_id') === -1;
},
+ startDiffRendering() {
+ requestIdleCallback(
+ () => {
+ this.startRenderDiffsQueue();
+ },
+ { timeout: 1000 },
+ );
+ },
fetchData(toggleTree = true) {
if (this.isLatestVersion() && this.glFeatures.diffsBatchLoad) {
this.fetchDiffFilesMeta()
.then(() => {
if (toggleTree) this.hideTreeListIfJustOneFile();
+
+ this.startDiffRendering();
})
.catch(() => {
createFlash(__('Something went wrong on our end. Please try again!'));
});
this.fetchDiffFilesBatch()
- .then(() => {
- requestIdleCallback(
- () => {
- this.setDiscussions();
- this.startRenderDiffsQueue();
- },
- { timeout: 1000 },
- );
- })
+ .then(() => this.startDiffRendering())
.catch(() => {
createFlash(__('Something went wrong on our end. Please try again!'));
});
@@ -246,7 +256,6 @@ export default {
requestIdleCallback(
() => {
- this.setDiscussions();
this.startRenderDiffsQueue();
},
{ timeout: 1000 },
@@ -262,7 +271,7 @@ export default {
}
},
setDiscussions() {
- if (this.isNotesFetched && !this.assignedDiscussions && !this.isLoading) {
+ if (this.shouldSetDiscussions) {
this.assignedDiscussions = true;
requestIdleCallback(