summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/diffs/components/app.vue
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2018-08-13 10:47:54 +0200
committerTim Zallmann <tzallmann@gitlab.com>2018-09-07 12:25:50 +0200
commit4164c616e75f750d594f7d3a40bc1a32fd0137b6 (patch)
treee75cf3b080f0c4b8eb6da6966314b153cec54618 /app/assets/javascripts/diffs/components/app.vue
parent18c7a213eb02415bdbd7befeadc1434ad437f466 (diff)
downloadgitlab-ce-4164c616e75f750d594f7d3a40bc1a32fd0137b6.tar.gz
Loading Discussions later on Diffs
Diffstat (limited to 'app/assets/javascripts/diffs/components/app.vue')
-rw-r--r--app/assets/javascripts/diffs/components/app.vue25
1 files changed, 22 insertions, 3 deletions
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue
index b5b05df4d34..b801dd56392 100644
--- a/app/assets/javascripts/diffs/components/app.vue
+++ b/app/assets/javascripts/diffs/components/app.vue
@@ -59,7 +59,7 @@ export default {
emailPatchPath: state => state.diffs.emailPatchPath,
}),
...mapGetters('diffs', ['isParallelView']),
- ...mapGetters(['isNotesFetched']),
+ ...mapGetters(['isNotesFetched', 'discussionsStructuredByLineCode']),
targetBranch() {
return {
branchName: this.targetBranchName,
@@ -112,13 +112,32 @@ export default {
},
created() {
this.adjustView();
+ eventHub.$once('renderedFiles', this.assignDiscussionsToDiff);
},
methods: {
- ...mapActions('diffs', ['setBaseConfig', 'fetchDiffFiles', 'startRenderDiffsQueue']),
+ ...mapActions('diffs', [
+ 'setBaseConfig',
+ 'fetchDiffFiles',
+ 'startRenderDiffsQueue',
+ 'assignDiscussionsToDiff',
+ ]),
+
fetchData() {
this.fetchDiffFiles()
.then(() => {
- requestIdleCallback(this.startRenderDiffsQueue, { timeout: 1000 });
+ requestIdleCallback(
+ () => {
+ this.startRenderDiffsQueue()
+ .then(() => {
+ console.log('Done rendering Que');
+ this.assignDiscussionsToDiff(this.discussionsStructuredByLineCode);
+ })
+ .catch(() => {
+ createFlash(__('Something went wrong on our end. Please try again!'));
+ });
+ },
+ { timeout: 1000 },
+ );
})
.catch(() => {
createFlash(__('Something went wrong on our end. Please try again!'));