@@ -23,6 +23,7 @@ import { replaceableComponent } from "../../utils/replaceableComponent";
2323import { getKeyBindingsManager } from "../../KeyBindingsManager" ;
2424import ResizeNotifier from "../../utils/ResizeNotifier" ;
2525import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts" ;
26+ import UIStore , { UI_EVENTS } from "../../stores/UIStore" ;
2627
2728const DEBUG_SCROLL = false ;
2829
@@ -214,6 +215,8 @@ export default class ScrollPanel extends React.Component<IProps> {
214215
215216 componentDidMount ( ) {
216217 this . checkScroll ( ) ;
218+
219+ UIStore . instance . on ( UI_EVENTS . Resize , this . onUiResize ) ;
217220 }
218221
219222 componentDidUpdate ( ) {
@@ -236,6 +239,8 @@ export default class ScrollPanel extends React.Component<IProps> {
236239 if ( this . props . resizeNotifier ) {
237240 this . props . resizeNotifier . removeListener ( "middlePanelResizedNoisy" , this . onResize ) ;
238241 }
242+
243+ UIStore . instance . off ( UI_EVENTS . Resize , this . onUiResize ) ;
239244 }
240245
241246 private onScroll = ev => {
@@ -730,6 +735,17 @@ export default class ScrollPanel extends React.Component<IProps> {
730735 }
731736 }
732737
738+ private onUiResize = ( ) => {
739+ this . setDataScrollbar ( ) ;
740+ } ;
741+
742+ private setDataScrollbar ( contentHeight = this . getMessagesHeight ( ) ) {
743+ const sn = this . getScrollNode ( ) ;
744+ const minHeight = sn . clientHeight ;
745+ const displayScrollbar = contentHeight > minHeight ;
746+ sn . dataset . scrollbar = displayScrollbar . toString ( ) ;
747+ }
748+
733749 // need a better name that also indicates this will change scrollTop? Rebalance height? Reveal content?
734750 private async updateHeight ( ) : Promise < void > {
735751 // wait until user has stopped scrolling
@@ -751,8 +767,7 @@ export default class ScrollPanel extends React.Component<IProps> {
751767 const minHeight = sn . clientHeight ;
752768 const height = Math . max ( minHeight , contentHeight ) ;
753769 this . pages = Math . ceil ( height / PAGE_SIZE ) ;
754- const displayScrollbar = contentHeight > minHeight ;
755- sn . dataset . scrollbar = displayScrollbar . toString ( ) ;
770+ this . setDataScrollbar ( contentHeight ) ;
756771 this . bottomGrowth = 0 ;
757772 const newHeight = `${ this . getListHeight ( ) } px` ;
758773
0 commit comments