@@ -60,7 +60,7 @@ export class ChatWrapper {
6060 private readonly dragBlurOverlay : HTMLElement ;
6161 private dragOverlayVisibility : boolean = true ;
6262 private imageContextFeatureEnabled : boolean = false ;
63- private modifiedFilesTracker : ModifiedFilesTracker ;
63+ private readonly modifiedFilesTracker : ModifiedFilesTracker ;
6464
6565 constructor ( props : ChatWrapperProps ) {
6666 StyleLoader . getInstance ( ) . load ( 'components/chat/_chat-wrapper.scss' ) ;
@@ -393,18 +393,13 @@ export class ChatWrapper {
393393 // Check if messageId contains "modified-files-" prefix
394394 if ( chatItem . messageId != null && chatItem . messageId !== '' && chatItem . messageId . includes ( 'modified-files-' ) ) {
395395 // Forward only to ModifiedFilesTracker, skip normal flow
396- if ( chatItem . fileList !== null ) {
396+ if ( chatItem . header ?. fileList !== null && chatItem . header ?. fileList !== undefined ) {
397397 this . allRenderedModifiedFileChatItems [ chatItem . messageId ] = chatItem ;
398398 const size = Object . keys ( this . allRenderedModifiedFileChatItems ) . length ;
399399 chatItem . title = size === 1 ? '1 file modified!' : `${ size } files modified!` ;
400- } else if ( chatItem . fileList === null || chatItem . fileList === undefined ) {
401- // This will mean that it is reset signal i.e. new chat;
402- // Ideally should be sent through controller
403- chatItem . title = 'working ...' ;
404- // remove all items from allRenderedModifiedFileChatItems
405- this . allRenderedModifiedFileChatItems = { } ;
406- this . modifiedFilesTracker = new ModifiedFilesTracker ( { tabId : this . props . tabId } ) ;
407400 }
401+ // else clear the component and render empty
402+ // previous implementation was not working; Need a fix
408403 this . modifiedFilesTracker . addChatItem ( chatItem ) ;
409404 return ;
410405 }
@@ -440,6 +435,9 @@ export class ChatWrapper {
440435 this . allRenderedChatItems [ currentMessageId ] = chatItemCard ;
441436
442437 if ( chatItem . type === ChatItemType . PROMPT || chatItem . type === ChatItemType . SYSTEM_PROMPT ) {
438+ // Clear modified files tracker on new prompt
439+ this . allRenderedModifiedFileChatItems = { } ;
440+ this . modifiedFilesTracker . clear ( ) ;
443441 // Make sure we align to top when there is a new prompt.
444442 // Only if it is a PROMPT!
445443 // Check css application
0 commit comments