Stop multiple discussion requests

With multiple discussion requests we loose the reactivity of the
previously stored discussions state.
This means that certain features, toggling line discussions for example,
are no longer reactive.
This commit is contained in:
Phil Hughes 2018-11-08 10:42:11 +00:00
parent 369631c841
commit 1519c3470c
No known key found for this signature in database
GPG Key ID: 32245528C52E0F9F
1 changed files with 6 additions and 0 deletions

View File

@ -50,6 +50,7 @@ export default {
}, },
data() { data() {
return { return {
isFetching: false,
currentFilter: null, currentFilter: null,
}; };
}, },
@ -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 {
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())