impact-chatbot 2.3.9 → 2.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -6426,12 +6426,11 @@ const StreamedContent = ({ botData }) => {
6426
6426
  sourceRef.current.close();
6427
6427
  setIsStreaming(false);
6428
6428
  setIsStreamingDone(true);
6429
- // Clean up stream state in module-level Map
6430
- const abortState = streamStateMap.get(streamKey);
6431
- if (abortState) {
6432
- abortState.completed = true;
6433
- abortState.source = null;
6434
- }
6429
+ // Delete module-level Map entry immediately on abort.
6430
+ // This ensures if the component unmounts before the isStreamingDone effect runs
6431
+ // (e.g. handleNewChatClick clears conversation), the next mount with the same
6432
+ // streamKey starts a fresh stream instead of restoring the aborted one.
6433
+ streamStateMap.delete(streamKey);
6435
6434
  // Stop the agent flow on the backend
6436
6435
  if (messageToStoreRef.current.sessionId) {
6437
6436
  chatbotServices.stopAgentFlow({ session_id: messageToStoreRef.current.sessionId }, baseUrl);