From 52efd2fde5bafd2bb8b4c1eab8c4c15fd111468b Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sat, 18 Jul 2020 00:02:28 +0200 Subject: [PATCH] Improved the channel tree scroll fix handler and updated the ChangeLog.md --- ChangeLog.md | 3 ++- shared/js/ui/tree/View.tsx | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index d00c2f73..186f1b09 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,5 @@ # Changelog: -* **XX.XX.20** +* **18.07.20** - Rewrote the channel conversation UI and manager - Several bug fixes like the scrollbar - Updated the channel history view mode @@ -17,6 +17,7 @@ - Fixed chat scroll bar after switching tabs - Fixed the chat "scroll to new messages" button - Finalized the loader animation + - Improved the channel tree scroll fix handler * **12.07.20** - Made the loader compatible with ES5 to support older browsers diff --git a/shared/js/ui/tree/View.tsx b/shared/js/ui/tree/View.tsx index 38df46c0..58561cc4 100644 --- a/shared/js/ui/tree/View.tsx +++ b/shared/js/ui/tree/View.tsx @@ -62,7 +62,7 @@ export class ChannelTreeView extends ReactComponentBase { - clearTimeout(this.fixScrollTimer); if(!event.visible) { this.setState({ smoothScroll: false }); return; } - this.fixScrollTimer = setTimeout(() => { + if(this.scrollFixRequested) + return; + + this.scrollFixRequested = true; + requestAnimationFrame(() => { + this.scrollFixRequested = false; this.ref_container.current.scrollTop = this.state.scroll_offset; - this.fixScrollTimer = setTimeout(() => { - this.setState({ smoothScroll: true }); - }, 50); - }, 50); + this.setState({ smoothScroll: true }); + }); } }