Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(chat): Don't send startTyping signaling message for each keystroke #9603

Merged
merged 1 commit into from
May 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions src/components/NewMessage/NewMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -384,17 +384,18 @@ export default {

// Enable signal sending, only if indicator for this input is on
if (this.showTypingStatus) {
clearTimeout(this.typingTimeout)

if (!newValue) {
this.$store.dispatch('setTyping', { typing: false })
this.resetTypingIndicator()
ShGKme marked this conversation as resolved.
Show resolved Hide resolved
return
}

this.typingTimeout = setTimeout(() => {
this.$store.dispatch('setTyping', { typing: false })
}, 5000)
this.$store.dispatch('setTyping', { typing: true })
if (!this.typingTimeout) {
this.typingTimeout = setTimeout(() => {
this.resetTypingIndicator()
}, 5000)
this.$store.dispatch('setTyping', { typing: true })
}

}
},

Expand All @@ -404,7 +405,7 @@ export default {
} else {
this.text = ''
}
this.$store.dispatch('setTyping', { typing: false })
this.resetTypingIndicator()
},
},

Expand All @@ -426,6 +427,13 @@ export default {
},

methods: {
resetTypingIndicator() {
if (this.typingTimeout) {
clearTimeout(this.typingTimeout)
}
this.$store.dispatch('setTyping', { typing: false })
},

handleUploadStart() {
// refocus on upload start as the user might want to type again while the upload is running
this.focusInput()
Expand Down