Skip to content

Commit e1a040a

Browse files
committed
msg:working but not tested
- removed unnecessary logging and made a little more type safe
1 parent 5e50abe commit e1a040a

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

src/components/modified-files-tracker.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,7 @@ export class ModifiedFilesTracker {
6161
this.renderModifiedFiles(tabDataStore.getValue('modifiedFilesList'));
6262
}
6363

64-
private clearContent (): void {
65-
const contentWrapper = this.collapsibleContent.render.querySelector('.mynah-collapsible-content-label-content-wrapper');
66-
if (contentWrapper != null) {
67-
contentWrapper.innerHTML = '';
68-
}
69-
}
70-
7164
private renderModifiedFiles (fileList: ChatItemContent['fileList'] | null): void {
72-
const fileListWithButtons = fileList as any;
73-
console.log('[ModifiedFilesTracker] renderModifiedFiles called with:', JSON.stringify({
74-
hasFileList: fileList != null,
75-
filePathsCount: fileList?.filePaths?.length ?? 0,
76-
hasButtons: fileListWithButtons?.buttons != null,
77-
buttonsCount: fileListWithButtons?.buttons?.length ?? 0,
78-
buttons: fileListWithButtons?.buttons?.map((b: any) => ({ id: b.id, text: b.text })) ?? []
79-
}, null, 2));
80-
8165
const contentWrapper = this.collapsibleContent.render.querySelector('.mynah-collapsible-content-label-content-wrapper');
8266
if (contentWrapper == null) return;
8367

@@ -98,13 +82,13 @@ export class ModifiedFilesTracker {
9882
}));
9983
}
10084

101-
private renderFilePills (contentWrapper: Element, fileList: NonNullable<ChatItemContent['fileList']>): void {
102-
const defaultMessageId = 'modified-files-tracker';
85+
private renderFilePills (contentWrapper: Element, fileList: NonNullable<ChatItemContent['fileList']> & { messageId?: string }): void {
86+
const messageId = fileList.messageId ?? `modified-files-tracker-${this.props.tabId}`;
10387

10488
// Render the file tree with actions and buttons as provided by the data
10589
contentWrapper.appendChild(new ChatItemTreeViewWrapper({
10690
tabId: this.props.tabId,
107-
messageId: defaultMessageId,
91+
messageId,
10892
files: fileList.filePaths ?? [],
10993
cardTitle: '',
11094
rootTitle: fileList.rootFolderTitle,
@@ -120,7 +104,7 @@ export class ModifiedFilesTracker {
120104
}).render);
121105

122106
// Render buttons if they exist
123-
const fileListWithButtons = fileList as any;
107+
const fileListWithButtons = fileList as ChatItemContent['fileList'] & { buttons?: ChatItemButton[] };
124108
const buttons: ChatItemButton[] | undefined = fileListWithButtons.buttons;
125109
if (Array.isArray(buttons) && buttons.length > 0) {
126110
const buttonsWrapper = new ChatItemButtonsWrapper({
@@ -129,7 +113,7 @@ export class ModifiedFilesTracker {
129113
onActionClick: (action: ChatItemButton) => {
130114
MynahUIGlobalEvents.getInstance().dispatch(MynahEventNames.BODY_ACTION_CLICKED, {
131115
tabId: this.props.tabId,
132-
messageId: (action as any).messageId != null ? (action as any).messageId : defaultMessageId,
116+
messageId: (action as any).messageId != null ? (action as any).messageId : messageId,
133117
actionId: action.id,
134118
actionText: action.text
135119
});

0 commit comments

Comments
 (0)