From d31a819d7d33829ddb59a44e47bcb24c65b6242c Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Sun, 3 Apr 2022 23:10:51 +0300 Subject: [PATCH] Fix glitch on first forwarding in inner chat --- src/components/chat/bubbles.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/chat/bubbles.ts b/src/components/chat/bubbles.ts index 0853fed4..d7a00d74 100644 --- a/src/components/chat/bubbles.ts +++ b/src/components/chat/bubbles.ts @@ -883,7 +883,7 @@ export default class ChatBubbles { } const container = this.scrollable.container; - let wasHeight = container.offsetHeight; + let wasHeight = 0/* container.offsetHeight */; let resizing = false; let skip = false; let scrolled = 0; @@ -4052,9 +4052,10 @@ export default class ChatBubbles { if(scrollSaver) { scrollSaver.restore(history.length === 1 && !reverse ? false : true); + const className = 'has-sticky-dates'; const state = scrollSaver.getSaved(); const isLoading = !this.preloader.detached; - if(state.scrollHeight !== state.clientHeight || isLoading) { + if((state.scrollHeight !== state.clientHeight || isLoading) && !this.bubblesContainer.classList.contains(className)) { /* for(const timestamp in this.dateMessages) { const dateMessage = this.dateMessages[timestamp]; dateMessage.div.classList.add('is-sticky'); @@ -4063,7 +4064,7 @@ export default class ChatBubbles { const middleware = this.getMiddleware(); const callback = () => { if(!middleware()) return; - this.bubblesContainer.classList.add('has-sticky-dates'); + this.bubblesContainer.classList.add(className); }; if(this.willScrollOnLoad) {