mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 03:27:52 +00:00
fix: Reset recorder and attachments when switching chats (#11174)
# Pull Request Template ## Description This PR will reset the recorder and clear attachments when switching chats. It ensures that any ongoing recordings or attached files do not persist across different conversations Fixes https://linear.app/chatwoot/issue/CW-4157/recorded-audio-is-being-preserved-between-conversations https://github.com/chatwoot/chatwoot/issues/11136 ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? ### Loom video https://www.loom.com/share/6d6361650794426497467d6de1b4900d?sid=d856c540-1032-4ea2-8765-8704b76e8e1d ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
This commit is contained in:
@@ -420,6 +420,7 @@ export default {
|
|||||||
if (conversationId !== oldConversationId) {
|
if (conversationId !== oldConversationId) {
|
||||||
this.setToDraft(oldConversationId, this.replyType);
|
this.setToDraft(oldConversationId, this.replyType);
|
||||||
this.getFromDraft();
|
this.getFromDraft();
|
||||||
|
this.resetRecorderAndClearAttachments();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
message(updatedMessage) {
|
message(updatedMessage) {
|
||||||
@@ -529,6 +530,12 @@ export default {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
resetRecorderAndClearAttachments() {
|
||||||
|
// Reset audio recorder UI state
|
||||||
|
this.resetAudioRecorderInput();
|
||||||
|
// Reset attached files
|
||||||
|
this.attachedFiles = [];
|
||||||
|
},
|
||||||
saveDraft(conversationId, replyType) {
|
saveDraft(conversationId, replyType) {
|
||||||
if (this.message || this.message === '') {
|
if (this.message || this.message === '') {
|
||||||
const key = `draft-${conversationId}-${replyType}`;
|
const key = `draft-${conversationId}-${replyType}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user