Merge branch '48906-adding-a-diff-line-note-freezes-the-browser' into 'master'
Resolve "Adding a diff line note freezes the browser" Closes #48906 See merge request gitlab-org/gitlab-ce!20476
This commit is contained in:
commit
dc71b4004b
3 changed files with 12 additions and 4 deletions
|
@ -59,7 +59,7 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['cancelCommentForm', 'saveNote', 'fetchDiscussions']),
|
||||
...mapActions(['cancelCommentForm', 'saveNote', 'refetchDiscussionById']),
|
||||
handleCancelCommentForm() {
|
||||
this.autosave.reset();
|
||||
this.cancelCommentForm({
|
||||
|
@ -78,10 +78,10 @@ export default {
|
|||
});
|
||||
|
||||
this.saveNote(postData)
|
||||
.then(() => {
|
||||
.then(result => {
|
||||
const endpoint = this.getNotesDataByProp('discussionsPath');
|
||||
|
||||
this.fetchDiscussions(endpoint)
|
||||
this.refetchDiscussionById({ path: endpoint, discussionId: result.discussion_id })
|
||||
.then(() => {
|
||||
this.handleCancelCommentForm();
|
||||
})
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -114,7 +114,6 @@ export default {
|
|||
|
||||
Object.assign(state, { discussions });
|
||||
},
|
||||
|
||||
[types.SET_LAST_FETCHED_AT](state, fetchedAt) {
|
||||
Object.assign(state, { lastFetchedAt: fetchedAt });
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue