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';
import { __, sprintf } from '~/locale';
import Flash from '../../flash';
import Autosave from '../../autosave';
import TaskList from '../../task_list';
import {
capitalizeFirstCharacter,
convertToCamelCase,
......@@ -146,7 +145,6 @@ export default {
});
this.initAutoSave();
this.initTaskList();
},
methods: {
...mapActions([
......@@ -298,13 +296,6 @@ Please check your network connection and try again.`;
]);
}
},
initTaskList() {
return new TaskList({
dataType: 'note',
fieldName: 'note',
selector: '.notes',
});
},
resizeTextarea() {
this.$nextTick(() => {
Autosize.update(this.$refs.textarea);
......
......@@ -60,12 +60,13 @@ export const deleteNote = ({ commit, dispatch }, note) =>
dispatch('updateMergeRequestWidget');
});
export const updateNote = ({ commit }, { endpoint, note }) =>
export const updateNote = ({ commit, dispatch }, { endpoint, note }) =>
service
.updateNote(endpoint, note)
.then(res => res.json())
.then(res => {
commit(types.UPDATE_NOTE, res);
Vue.nextTick(() => dispatch('startTaskList'));
});
export const replyToDiscussion = ({ commit }, { endpoint, data }) =>
......@@ -262,6 +263,8 @@ const pollSuccessCallBack = (resp, commit, state, getters, dispatch) => {
commit(types.ADD_NEW_NOTE, note);
}
});
Vue.nextTick(() => dispatch('startTaskList'));
}
commit(types.SET_LAST_FETCHED_AT, resp.last_fetched_at);
......@@ -375,7 +378,7 @@ export const startTaskList = ({ dispatch }) =>
dataType: 'note',
fieldName: 'note',
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
......
---
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