Commit bd3a793f authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'notes-multiple-discussion-fetches' into 'master'

Stop multiple discussion requests

See merge request gitlab-org/gitlab-ce!22908
parents 2019d195 1519c347
...@@ -50,6 +50,7 @@ export default { ...@@ -50,6 +50,7 @@ export default {
}, },
data() { data() {
return { return {
isFetching: false,
currentFilter: null, currentFilter: null,
}; };
}, },
...@@ -141,6 +142,10 @@ export default { ...@@ -141,6 +142,10 @@ export default {
return discussion.individual_note ? { note: discussion.notes[0] } : { discussion }; return discussion.individual_note ? { note: discussion.notes[0] } : { discussion };
}, },
fetchNotes() { fetchNotes() {
if (this.isFetching) return null;
this.isFetching = true;
return this.fetchDiscussions({ path: this.getNotesDataByProp('discussionsPath') }) return this.fetchDiscussions({ path: this.getNotesDataByProp('discussionsPath') })
.then(() => { .then(() => {
this.initPolling(); this.initPolling();
...@@ -149,6 +154,7 @@ export default { ...@@ -149,6 +154,7 @@ export default {
this.setLoadingState(false); this.setLoadingState(false);
this.setNotesFetchedState(true); this.setNotesFetchedState(true);
eventHub.$emit('fetchedNotesData'); eventHub.$emit('fetchedNotesData');
this.isFetching = false;
}) })
.then(() => this.$nextTick()) .then(() => this.$nextTick())
.then(() => this.checkLocationHash()) .then(() => this.checkLocationHash())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment