Skip to content

Commit

Permalink
Merge pull request #412 from Cognigy/bug/65227-duplicate-input-and-ou…
Browse files Browse the repository at this point in the history
…tput-after-reconnecting

Fix dplicate messgaes in history after re-connecting
  • Loading branch information
sushmi21 authored May 7, 2024
2 parents d8c840d + 120222c commit cfd69d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/webchat/store/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export const reducer = (state = rootReducer(undefined, { type: '' }), action) =>
return rootReducer({
...state,
messages: [
...action.state.messages,
// To avoid duplicate messages in chat history during re-connection, we only restore messages if the current message history is empty
...state.messages.length === 0 && action.state.messages,
...state.messages,
],
rating: {
Expand Down

0 comments on commit cfd69d4

Please sign in to comment.