check is MessagesList is rendered before scrolling

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
This commit is contained in:
Maksim Sukharev 2023-07-24 09:34:12 +02:00
parent 996a8ca909
commit c651f648e3
No known key found for this signature in database
GPG key ID: 6349D071889BD1D5

View file

@ -945,7 +945,11 @@ export default {
* Scrolls to the bottom of the list smoothly.
*/
smoothScrollToBottom() {
this.$nextTick(function() {
this.$nextTick(() => {
if (!this.$refs.scroller) {
return
}
if (this.isWindowVisible && (document.hasFocus() || this.isInCall)) {
// scrollTo is used when the user is watching
this.$refs.scroller.scrollTo({
@ -970,7 +974,11 @@ export default {
* Scrolls to the bottom of the list.
*/
scrollToBottom() {
this.$nextTick(function() {
this.$nextTick(() => {
if (!this.$refs.scroller) {
return
}
this.$refs.scroller.scrollTop = this.$refs.scroller.scrollHeight
this.setChatScrolledToBottom(true)
})