Skip to content

Commit d638edf

Browse files
committed
Disable Intelligent Update API button for new and deleted files
1 parent 4afe080 commit d638edf

1 file changed

Lines changed: 22 additions & 19 deletions

File tree

‎packages/ui/src/components/editor/panel/ResponsePreview/ResponsePreview.tsx‎

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -191,25 +191,28 @@ export const ResponsePreview: FC<Props> = (props) => {
191191
</div>
192192
<div className={styles.list__file__right}>
193193
<div className={styles['list__file__actions']}>
194-
<IconButton
195-
codicon_icon="sparkle"
196-
title={`Call Intelligent Update API tool${
197-
file.diff_application_method == 'recount'
198-
? ' (fallback used: git apply with --recount flag)'
199-
: file.diff_application_method ==
200-
'search_and_replace'
201-
? ' (fallback used: search and replace matching fragments)'
202-
: ''
203-
}`}
204-
on_click={(e) => {
205-
e.stopPropagation()
206-
set_last_clicked_file_index(index)
207-
props.on_intelligent_update({
208-
file_path: file.file_path,
209-
workspace_name: file.workspace_name
210-
})
211-
}}
212-
/>
194+
{file.file_state != 'new' &&
195+
file.file_state != 'deleted' && (
196+
<IconButton
197+
codicon_icon="sparkle"
198+
title={`Call Intelligent Update API tool${
199+
file.diff_application_method == 'recount'
200+
? ' (fallback used: git apply with --recount flag)'
201+
: file.diff_application_method ==
202+
'search_and_replace'
203+
? ' (fallback used: search and replace matching fragments)'
204+
: ''
205+
}`}
206+
on_click={(e) => {
207+
e.stopPropagation()
208+
set_last_clicked_file_index(index)
209+
props.on_intelligent_update({
210+
file_path: file.file_path,
211+
workspace_name: file.workspace_name
212+
})
213+
}}
214+
/>
215+
)}
213216
<IconButton
214217
codicon_icon="go-to-file"
215218
title="Go To File"

0 commit comments

Comments
 (0)