Bug: Fix duplicate messages while using enter key on slow network (#987)
Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
@@ -212,18 +212,19 @@ export default {
|
|||||||
if (this.message.length > this.maxLength) {
|
if (this.message.length > this.maxLength) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const newMessage = this.message;
|
||||||
if (!this.showCannedResponsesList) {
|
if (!this.showCannedResponsesList) {
|
||||||
|
this.clearMessage();
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch('sendMessage', {
|
await this.$store.dispatch('sendMessage', {
|
||||||
conversationId: this.currentChat.id,
|
conversationId: this.currentChat.id,
|
||||||
message: this.message,
|
message: newMessage,
|
||||||
private: this.isPrivate,
|
private: this.isPrivate,
|
||||||
});
|
});
|
||||||
this.$emit('scrollToMessage');
|
this.$emit('scrollToMessage');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Error
|
// Error
|
||||||
}
|
}
|
||||||
this.clearMessage();
|
|
||||||
this.hideEmojiPicker();
|
this.hideEmojiPicker();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -35,3 +35,4 @@ conversation = Conversation.create!(
|
|||||||
additional_attributes: {}
|
additional_attributes: {}
|
||||||
)
|
)
|
||||||
Message.create!(content: 'Hello', account: account, inbox: inbox, conversation: conversation, message_type: :incoming)
|
Message.create!(content: 'Hello', account: account, inbox: inbox, conversation: conversation, message_type: :incoming)
|
||||||
|
CannedResponse.create!(account: account, short_code: 'start', content: 'Hello welcome to chatwoot.')
|
||||||
|
|||||||
Reference in New Issue
Block a user