diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2018-07-09 09:38:16 +0200 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2018-07-09 09:38:16 +0200 |
commit | e5b7fa6baf2963a96d188965b3dd3537033a0e82 (patch) | |
tree | 5eaab9efbdde5c64d9c29d449222d14da6081177 /app/assets/javascripts/notes/stores/actions.js | |
parent | 53760e8dcb2f2f8d878e10078c47bd6d6bc393fa (diff) | |
download | gitlab-ce-e5b7fa6baf2963a96d188965b3dd3537033a0e82.tar.gz |
This updates only the actual new discussion and not the full tree , which leads to a very costly full rerender
Diffstat (limited to 'app/assets/javascripts/notes/stores/actions.js')
-rw-r--r-- | app/assets/javascripts/notes/stores/actions.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 671fa4d7d22..b2bf86eea56 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -41,6 +41,15 @@ export const fetchDiscussions = ({ commit }, path) => commit(types.SET_INITIAL_DISCUSSIONS, discussions); }); +export const refetchDiscussionById = ({ commit }, { path, discussionId }) => + service + .fetchDiscussions(path) + .then(res => res.json()) + .then(discussions => { + const selectedDiscussion = discussions.find(discussion => discussion.id === discussionId); + if (selectedDiscussion) commit(types.UPDATE_DISCUSSION, selectedDiscussion); + }); + export const deleteNote = ({ commit }, note) => service.deleteNote(note.path).then(() => { commit(types.DELETE_NOTE, note); |