@@ -213,7 +213,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
213
213
this . _onDidClear . fire ( ) ;
214
214
}
215
215
216
- private onDidChangeItems ( ) {
216
+ private onDidChangeItems ( skipDynamicLayout ?: boolean ) {
217
217
if ( this . tree && this . visible ) {
218
218
const treeItems = ( this . viewModel ?. getItems ( ) ?? [ ] )
219
219
. map ( item => {
@@ -239,7 +239,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
239
239
}
240
240
} ) ;
241
241
242
- if ( this . _dynamicMessageLayoutData ) {
242
+ if ( ! skipDynamicLayout && this . _dynamicMessageLayoutData ) {
243
243
this . layoutDynamicChatTreeItemMode ( ) ;
244
244
}
245
245
@@ -270,7 +270,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
270
270
// Progressive rendering paused while hidden, so start it up again.
271
271
// Do it after a timeout because the container is not visible yet (it should be but offsetHeight returns 0 here)
272
272
if ( this . visible ) {
273
- this . onDidChangeItems ( ) ;
273
+ this . onDidChangeItems ( true ) ;
274
274
}
275
275
} , 0 ) ) ;
276
276
}
@@ -540,6 +540,11 @@ export class ChatWidget extends Disposable implements IChatWidget {
540
540
541
541
const mutableDisposable = this . _register ( new MutableDisposable ( ) ) ;
542
542
this . _register ( this . tree . onDidScroll ( ( e ) => {
543
+ // TODO@TylerLeonhardt this should probably just be disposed when this is disabled
544
+ // and then set up again when it is enabled again
545
+ if ( ! this . _dynamicMessageLayoutData ?. enabled ) {
546
+ return ;
547
+ }
543
548
mutableDisposable . value = dom . scheduleAtNextAnimationFrame ( ( ) => {
544
549
if ( ! e . scrollTopChanged || e . heightChanged || e . scrollHeightChanged ) {
545
550
return ;
@@ -593,7 +598,9 @@ export class ChatWidget extends Disposable implements IChatWidget {
593
598
if ( ! this . viewModel || ! this . _dynamicMessageLayoutData ?. enabled ) {
594
599
return ;
595
600
}
596
- const inputHeight = this . inputPart . layout ( this . _dynamicMessageLayoutData ! . maxHeight , this . container . offsetWidth ) ;
601
+
602
+ const width = this . bodyDimension ?. width ?? this . container . offsetWidth ;
603
+ const inputHeight = this . inputPart . layout ( this . _dynamicMessageLayoutData ! . maxHeight , width ) ;
597
604
598
605
const totalMessages = this . viewModel . getItems ( ) ;
599
606
// grab the last N messages
@@ -610,10 +617,10 @@ export class ChatWidget extends Disposable implements IChatWidget {
610
617
inputHeight + listHeight + ( totalMessages . length > 2 ? 18 : 0 ) ,
611
618
this . _dynamicMessageLayoutData ! . maxHeight
612
619
) ,
613
- this . container . offsetWidth
620
+ width
614
621
) ;
615
622
616
- if ( needsRerender ) {
623
+ if ( needsRerender || ! listHeight ) {
617
624
// TODO: figure out a better place to reveal the last element
618
625
revealLastElement ( this . tree ) ;
619
626
}
0 commit comments