Skip to content

Commit 8dd3f71

Browse files
Copilotalexr00
andcommitted
Improve useEffect to properly handle state changes
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 8974636 commit 8dd3f71

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

webviews/components/comment.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,7 @@ function EditComment({ id, body, isPRDescription, onCancel, onSave }: EditCommen
233233

234234
useEffect(() => {
235235
// Check if description generation is available
236-
if (isPRDescription && pr?.generateDescriptionTitle) {
237-
setCanGenerate(true);
238-
}
236+
setCanGenerate(isPRDescription === true && !!pr?.generateDescriptionTitle);
239237
}, [isPRDescription, pr?.generateDescriptionTitle]);
240238

241239
const submit = useCallback(async () => {

0 commit comments

Comments
 (0)