Skip to content
Snippets Groups Projects
Unverified Commit d4f6aa18 authored by Aleksander Nicacio da Silva's avatar Aleksander Nicacio da Silva Committed by GitHub
Browse files

fix: Livechat conversation not closing due to cross-tab interference (#35168)

parent 9f6a7b43
No related branches found
No related tags found
No related merge requests found
---
"@rocket.chat/livechat": patch
---
Fixes Livechat conversation not closing in a few scenarios due to cross-tab interference
......@@ -24,12 +24,7 @@ export const closeChat = async ({ transcriptRequested } = {}) => {
await handleTranscript();
}
const { room, department, config: { settings: { clearLocalStorageWhenChatEnded } = {} } = {} } = store.state;
if (!room) {
console.warn('closeChat called without a room');
return;
}
const { department, config: { settings: { clearLocalStorageWhenChatEnded } = {} } = {} } = store.state;
await store.setState({ room: null, renderedTriggers: [] });
......
......@@ -2,6 +2,7 @@ import { Component } from 'preact';
import { route } from 'preact-router';
import { withTranslation } from 'react-i18next';
import Chat from './component';
import { Livechat } from '../../api';
import { ModalManager } from '../../components/Modal';
import { getAvatarUrl } from '../../helpers/baseUrl';
......@@ -22,9 +23,8 @@ import constants from '../../lib/constants';
import { getLastReadMessage, loadConfig, processUnread, shouldMarkAsUnread } from '../../lib/main';
import { parentCall, runCallbackEventEmitter } from '../../lib/parentCall';
import { createToken } from '../../lib/random';
import { initRoom, closeChat, loadMessages, loadMoreMessages, defaultRoomParams, getGreetingMessages } from '../../lib/room';
import { initRoom, loadMessages, loadMoreMessages, defaultRoomParams, getGreetingMessages } from '../../lib/room';
import store from '../../store';
import Chat from './component';
const ChatWrapper = ({ children, rid }) => {
useRoomMessagesSubscription(rid);
......@@ -254,7 +254,6 @@ class ChatContainer extends Component {
await dispatch({ alerts: (alerts.push(alert), alerts) });
} finally {
await dispatch({ loading: false });
await closeChat();
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment