UX: scroll to bottom when message is staged (#21408)

Since our recent change of inverting thread scrolling direction it feels more responsive to scroll down in thread panel as soon as message is staged and not after it's actually persisted.
This commit is contained in:
Joffrey JAFFEUX 2023-05-05 13:14:13 +02:00 committed by GitHub
parent e88b997153
commit 78616404ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,6 +190,8 @@ export default class ChatThreadPanel extends Component {
this.resetComposer();
this.thread.messagesManager.addMessages([stagedMessage]);
this.scrollToBottom();
return this.chatApi
.sendMessage(this.channel.id, {
message: stagedMessage.message,
@ -199,9 +201,6 @@ export default class ChatThreadPanel extends Component {
thread_id: this.thread.staged ? null : stagedMessage.thread.id,
staged_thread_id: this.thread.staged ? stagedMessage.thread.id : null,
})
.then(() => {
this.scrollToBottom();
})
.catch((error) => {
this.#onSendError(stagedMessage.id, error);
})