Skip to content

Commit

Permalink
Merge pull request #51 from ML-Leonardo/fix/BCP_-2070183780-Button-Cl…
Browse files Browse the repository at this point in the history
…ick-Twice

Only allow one click on a Quick Reply button to avoid sending message…
  • Loading branch information
JWandrocke authored and GitHub Enterprise committed May 8, 2020
2 parents b14cac5 + e22bd12 commit 174b089
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/Message/QuickReplies.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,18 @@ class QuickReplies extends Component {

buttons = {}

_messageHasAlreadyBeenSent = false
doSendMessage = message => {
this.props.sendMessage(message)
this.setState({ displayQuickReplies: false })
// BCP https://support.wdf.sap.corp/sap/support/message/2070183780
// Handle double click on slow systems
// Once the _messageHasAlreadyBeenSent is true,
// then one button click has already been send.
if (!this._messageHasAlreadyBeenSent) {
this._messageHasAlreadyBeenSent = true
this.setState({ displayQuickReplies: false }, () => {
this.props.sendMessage(message)
})
}
}

render () {
Expand Down

0 comments on commit 174b089

Please sign in to comment.