Skip to content

Commit

Permalink
Merge pull request #563 from microsoft/users/mithunj/fixRequestId
Browse files Browse the repository at this point in the history
bug fix to clean up previous request id if there is no conversation a…
  • Loading branch information
mithunjohny authored Dec 17, 2024
2 parents 121a466 + 8a51c81 commit c715d8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGE_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ All notable changes to this project will be documented in this file.
- Padding property to control the padding size choice input adaptive card form field

### Fixed

- Fixed resetting request id when getConversationDetails returns wrap or closed state
- For disconnected chats, perform a soft end chat.
- Audio button visibility state is tied to audio mute state.
- Restriction of the elements allowed to be render in the UI, to avoid security vulnerabilities.
Expand Down
11 changes: 5 additions & 6 deletions chat-widget/src/components/livechatwidget/common/startChat.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
import { Constants, LiveWorkItemState, WidgetLoadCustomErrorString, WidgetLoadTelemetryMessage } from "../../../common/Constants";
import { checkContactIdError, createTimer, getConversationDetailsCall, getStateFromCache, getWidgetCacheIdfromProps, isNullOrEmptyString, isUndefinedOrEmpty } from "../../../common/utils";
import { checkContactIdError, createTimer, getConversationDetailsCall, getStateFromCache, getWidgetCacheIdfromProps, isNullOrEmptyString, isNullOrUndefined, isUndefinedOrEmpty } from "../../../common/utils";
import { getAuthClientFunction, handleAuthentication } from "./authHelper";
import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "./reconnectChatHelper";
import { handleStartChatError, logWidgetLoadComplete } from "./startChatErrorHandler";
Expand Down Expand Up @@ -338,12 +338,11 @@ const checkIfConversationStillValid = async (chatSDK: any, dispatch: Dispatch<IL
chatSDK.requestId = requestIdFromCache;
conversationDetails = await getConversationDetailsCall(chatSDK, liveChatContext);

if (Object.keys(conversationDetails).length === 0) {
return false;
}

if (conversationDetails.state === LiveWorkItemState.Closed || conversationDetails.state === LiveWorkItemState.WrapUp) {
if (Object.keys(conversationDetails).length === 0 || isNullOrUndefined(conversationDetails.state) || conversationDetails.state === LiveWorkItemState.Closed || conversationDetails.state === LiveWorkItemState.WrapUp) {
dispatch({ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT, payload: undefined });
if (currentRequestId) {
chatSDK.requestId = currentRequestId;
}
return false;
}
return true;
Expand Down

0 comments on commit c715d8f

Please sign in to comment.