diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-04 18:08:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-04 18:08:46 +0000 |
commit | b41cd8cb92d53454b2b160ba922d33801933a9cf (patch) | |
tree | 3519da8856f8bf12ce9e75248e5ecb9ed4eacf14 /app/assets/javascripts/diffs/components/app.vue | |
parent | 8d3aee3636da5181ae94d23b47c6794b5610ab01 (diff) | |
download | gitlab-ce-b41cd8cb92d53454b2b160ba922d33801933a9cf.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/diffs/components/app.vue')
-rw-r--r-- | app/assets/javascripts/diffs/components/app.vue | 31 |
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( |