Commit 2f301913 authored by Samantha Ming's avatar Samantha Ming

Prevent autosave when reply comment via cmd+enter

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/216631

When a user reply to a comment  using cmd + enter
and trigger another reply, the previous comment reappears.
In this commit, we fix this problem by prevent an autosave when user
reply to a comment using cmd + enter .
So when the user trigger another reply, it will be a clean slate.
parent 0d2fd48e
......@@ -101,6 +101,7 @@ export default {
isResolving: this.resolveDiscussion,
isUnresolving: !this.resolveDiscussion,
resolveAsThread: true,
isSubmittingWithKeydown: false,
};
},
computed: {
......@@ -241,6 +242,10 @@ export default {
this.$emit('cancelForm', shouldConfirm, this.noteBody !== this.updatedNoteBody);
},
onInput() {
if (this.isSubmittingWithKeydown) {
return;
}
if (this.autosaveKey) {
const { autosaveKey, updatedNoteBody: text } = this;
updateDraft(autosaveKey, text);
......@@ -250,6 +255,7 @@ export default {
if (this.showBatchCommentsActions) {
this.handleAddToReview();
} else {
this.isSubmittingWithKeydown = true;
this.handleUpdate();
}
},
......
---
title: Prevent autosave when reply comment via cmd+enter
merge_request: 35716
author:
type: fixed
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