@@ -60,7 +60,7 @@ export class ChatWrapper {
6060 private dragOverlayVisibility : boolean = true ;
6161 private imageContextFeatureEnabled : boolean = false ;
6262 private readonly modifiedFilesTracker : ModifiedFilesTracker ;
63- private modifiedFilesChatItem : ChatItem | null = null ;
63+
6464
6565 constructor ( props : ChatWrapperProps ) {
6666 StyleLoader . getInstance ( ) . load ( 'components/chat/_chat-wrapper.scss' ) ;
@@ -387,14 +387,17 @@ export class ChatWrapper {
387387 } ;
388388
389389 private readonly insertChatItem = ( chatItem : ChatItem ) : void => {
390- // Log chatItem details (only non-undefined properties)
391- const definedProps = Object . fromEntries (
392- Object . entries ( chatItem ) . filter ( ( [ _ , value ] ) => value !== undefined )
393- ) ;
394- console . log ( '[ChatWrapper] insertChatItem received chatItem:' , definedProps ) ;
395-
390+ // Normal flow on initially opening ui requires the currentMessageId;
396391 this . removeEmptyCardsAndFollowups ( ) ;
397392 const currentMessageId : string = ( chatItem . messageId != null && chatItem . messageId !== '' ) ? chatItem . messageId : `TEMP_${ generateUID ( ) } ` ;
393+ // Check if messageId contains "modified-files-" prefix
394+ if ( chatItem . messageId != null && chatItem . messageId !== '' && chatItem . messageId . includes ( 'modified-files-' ) ) {
395+ // Forward only to ModifiedFilesTracker, skip normal flow
396+ this . modifiedFilesTracker . addChatItem ( chatItem ) ;
397+ return ;
398+ }
399+
400+ // Normal flow for all other chat items
398401 const chatItemCard = new ChatItemCard ( {
399402 tabId : this . props . tabId ,
400403 chatItem : {
@@ -424,15 +427,6 @@ export class ChatWrapper {
424427 // Add to all rendered chat items map
425428 this . allRenderedChatItems [ currentMessageId ] = chatItemCard ;
426429
427- // Update ModifiedFilesTracker only if chatItem messageId contains suffix "modified-files-"
428- if ( chatItem . messageId != null && chatItem . header ?. fileList != null ) {
429- if ( chatItem . messageId . includes ( 'modified-files-' ) ) {
430- console . log ( '[ChatWrapper] Setting ModifiedFilesChatItem with fileList:' , chatItem . header . fileList ) ;
431- this . setModifiedFilesChatItem ( chatItem ) ;
432- return ;
433- }
434- }
435-
436430 if ( chatItem . type === ChatItemType . PROMPT || chatItem . type === ChatItemType . SYSTEM_PROMPT ) {
437431 // Make sure we align to top when there is a new prompt.
438432 // Only if it is a PROMPT!
@@ -562,23 +556,4 @@ export class ChatWrapper {
562556 this . dragOverlayContent . style . display = visible ? 'flex' : 'none' ;
563557 this . dragBlurOverlay . style . display = visible ? 'block' : 'none' ;
564558 }
565-
566- public setModifiedFilesTrackerVisible ( visible : boolean ) : void {
567- // No-op: component is always visible
568- }
569-
570- public updateModifiedFilesTracker ( ) : void {
571- if ( this . modifiedFilesChatItem != null ) {
572- this . modifiedFilesTracker . addChatItem ( this . modifiedFilesChatItem ) ;
573- }
574- }
575-
576- public setModifiedFilesChatItem ( chatItem : ChatItem ) : void {
577- console . log ( '[ChatWrapper] setModifiedFilesChatItem called with:' , {
578- messageId : chatItem . messageId ,
579- fileList : chatItem . header ?. fileList
580- } ) ;
581- this . modifiedFilesChatItem = chatItem ;
582- this . updateModifiedFilesTracker ( ) ;
583- }
584559}
0 commit comments