fix: Prevent duplicate chat creation in the web widget during latency (#10745)

This commit is contained in:
Sivin Varghese
2025-01-23 12:53:28 +05:30
committed by GitHub
parent be8205657e
commit d3d39a81d6
10 changed files with 90 additions and 8 deletions

View File

@@ -12,12 +12,20 @@ export default {
},
mixins: [configMixin, routerMixin],
mounted() {
emitter.on(ON_CONVERSATION_CREATED, () => {
// Redirect to messages page after conversation is created
this.replaceRoute('messages');
});
// Register event listener for conversation creation
emitter.on(ON_CONVERSATION_CREATED, this.handleConversationCreated);
},
beforeUnmount() {
emitter.off(ON_CONVERSATION_CREATED, this.handleConversationCreated);
},
methods: {
handleConversationCreated() {
// Redirect to messages page after conversation is created
this.replaceRoute('messages');
// Only after successful navigation, reset the isUpdatingRoute UIflag in app/javascript/widget/router.js
// See issue: https://github.com/chatwoot/chatwoot/issues/10736
},
onSubmit({
fullName,
emailAddress,