Skip to content

Commit 002dfbb

Browse files
committed
Clean up
1 parent 8dd3f71 commit 002dfbb

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

webviews/components/comment.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ function EditComment({ id, body, isPRDescription, onCancel, onSave }: EditCommen
219219
const draftComment = useRef<{ body: string; dirty: boolean }>({ body, dirty: false });
220220
const form = useRef<HTMLFormElement>();
221221
const [isGenerating, setIsGenerating] = useState(false);
222-
const [canGenerate, setCanGenerate] = useState(false);
223222

224223
useEffect(() => {
225224
const interval = setInterval(() => {
@@ -231,11 +230,6 @@ function EditComment({ id, body, isPRDescription, onCancel, onSave }: EditCommen
231230
return () => clearInterval(interval);
232231
}, [draftComment]);
233232

234-
useEffect(() => {
235-
// Check if description generation is available
236-
setCanGenerate(isPRDescription === true && !!pr?.generateDescriptionTitle);
237-
}, [isPRDescription, pr?.generateDescriptionTitle]);
238-
239233
const submit = useCallback(async () => {
240234
const { markdown, submitButton }: FormInputSet = form.current!;
241235
submitButton.disabled = true;
@@ -301,21 +295,21 @@ function EditComment({ id, body, isPRDescription, onCancel, onSave }: EditCommen
301295
<form ref={form as React.MutableRefObject<HTMLFormElement>} onSubmit={onSubmit}>
302296
<div className="textarea-wrapper">
303297
<textarea name="markdown" defaultValue={body} onKeyDown={onKeyDown} onInput={onInput} disabled={isGenerating} />
304-
{canGenerate && isPRDescription ? (
298+
{isPRDescription ? (
305299
isGenerating ? (
306-
<button
300+
<button
307301
type="button"
308-
title="Cancel"
309-
className="title-action icon-button"
302+
title="Cancel"
303+
className="title-action icon-button"
310304
onClick={handleCancelGenerate}
311305
>
312306
{stopCircleIcon}
313307
</button>
314308
) : (
315-
<button
309+
<button
316310
type="button"
317-
title={pr?.generateDescriptionTitle || 'Generate description'}
318-
className="title-action icon-button"
311+
title={pr?.generateDescriptionTitle || 'Generate description'}
312+
className="title-action icon-button"
319313
onClick={handleGenerateDescription}
320314
>
321315
{sparkleIcon}

0 commit comments

Comments
 (0)