Commit 5796221b authored by Phil Hughes's avatar Phil Hughes

Fix TaskList init on update & poll

Fixed duplicate TaskList requests being made
parent cfedc31b
...@@ -6,7 +6,6 @@ import Autosize from 'autosize'; ...@@ -6,7 +6,6 @@ import Autosize from 'autosize';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import Flash from '../../flash'; import Flash from '../../flash';
import Autosave from '../../autosave'; import Autosave from '../../autosave';
import TaskList from '../../task_list';
import { import {
capitalizeFirstCharacter, capitalizeFirstCharacter,
convertToCamelCase, convertToCamelCase,
...@@ -146,7 +145,6 @@ export default { ...@@ -146,7 +145,6 @@ export default {
}); });
this.initAutoSave(); this.initAutoSave();
this.initTaskList();
}, },
methods: { methods: {
...mapActions([ ...mapActions([
...@@ -298,13 +296,6 @@ Please check your network connection and try again.`; ...@@ -298,13 +296,6 @@ Please check your network connection and try again.`;
]); ]);
} }
}, },
initTaskList() {
return new TaskList({
dataType: 'note',
fieldName: 'note',
selector: '.notes',
});
},
resizeTextarea() { resizeTextarea() {
this.$nextTick(() => { this.$nextTick(() => {
Autosize.update(this.$refs.textarea); Autosize.update(this.$refs.textarea);
......
...@@ -60,12 +60,13 @@ export const deleteNote = ({ commit, dispatch }, note) => ...@@ -60,12 +60,13 @@ export const deleteNote = ({ commit, dispatch }, note) =>
dispatch('updateMergeRequestWidget'); dispatch('updateMergeRequestWidget');
}); });
export const updateNote = ({ commit }, { endpoint, note }) => export const updateNote = ({ commit, dispatch }, { endpoint, note }) =>
service service
.updateNote(endpoint, note) .updateNote(endpoint, note)
.then(res => res.json()) .then(res => res.json())
.then(res => { .then(res => {
commit(types.UPDATE_NOTE, res); commit(types.UPDATE_NOTE, res);
Vue.nextTick(() => dispatch('startTaskList'));
}); });
export const replyToDiscussion = ({ commit }, { endpoint, data }) => export const replyToDiscussion = ({ commit }, { endpoint, data }) =>
...@@ -262,6 +263,8 @@ const pollSuccessCallBack = (resp, commit, state, getters, dispatch) => { ...@@ -262,6 +263,8 @@ const pollSuccessCallBack = (resp, commit, state, getters, dispatch) => {
commit(types.ADD_NEW_NOTE, note); commit(types.ADD_NEW_NOTE, note);
} }
}); });
Vue.nextTick(() => dispatch('startTaskList'));
} }
commit(types.SET_LAST_FETCHED_AT, resp.last_fetched_at); commit(types.SET_LAST_FETCHED_AT, resp.last_fetched_at);
...@@ -375,7 +378,7 @@ export const startTaskList = ({ dispatch }) => ...@@ -375,7 +378,7 @@ export const startTaskList = ({ dispatch }) =>
dataType: 'note', dataType: 'note',
fieldName: 'note', fieldName: 'note',
selector: '.notes .is-editable', selector: '.notes .is-editable',
onSuccess: () => Vue.$nextTick(() => dispatch('startTaskList')), onSuccess: () => Vue.nextTick(() => dispatch('startTaskList')),
}); });
// prevent babel-plugin-rewire from generating an invalid default during karma tests // prevent babel-plugin-rewire from generating an invalid default during karma tests
......
---
title: Improve initial discussion rendering performance
merge_request: 22607
author:
type: changed
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