Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Commit

Permalink
Fixes app not sending messages after history is cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Capewell committed Feb 9, 2018
1 parent c1c4ccb commit 7413ace
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/js/socketManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function subscribeSendMessageListener () {

const sentMessages = state.sentMessages

if ( previousState.length !== sentMessages.length && previousState.length < sentMessages.length ) {
if ( previousState.length < sentMessages.length ) {
previousState = sentMessages

const newMessage = sentMessages.slice(-1)[0]
Expand All @@ -199,6 +199,10 @@ function subscribeSendMessageListener () {
const socket = connection.socket

socket.emit(newMessage.eventName, ...newMessage.message)

} else if (previousState.length > sentMessages.length) {
// update the record of sent messages when queue is cleared
previousState = store.getState().sentMessages
}
})
}
Expand Down

0 comments on commit 7413ace

Please sign in to comment.