Skip to content

Commit

Permalink
quickfix: do not allow empty commit title
Browse files Browse the repository at this point in the history
  • Loading branch information
geclos committed Nov 20, 2024
1 parent 0853421 commit 3c71aba
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,16 @@ function confirmDescription({
isLoading,
anyChanges,
hasErrors,
title,
}: {
anyChanges: boolean
hasErrors: boolean
isLoading: boolean
title: string
}) {
if (isLoading) return undefined
if (!anyChanges) return 'No changes to publish.'

if (!title.trim()) return 'Please provide a version name.'
if (hasErrors)
return 'Some documents has errors, please click on those documents to see the errors.'
return 'Publishing a new version will update all your prompts in production.'
Expand Down Expand Up @@ -335,14 +337,20 @@ export default function PublishDraftCommitModal({
}
confirm={{
label: isLoading ? 'Validating...' : 'Publish to production',
description: confirmDescription({ isLoading, anyChanges, hasErrors }),
disabled: isLoading || hasErrors,
description: confirmDescription({
isLoading,
anyChanges,
hasErrors,
title,
}),
disabled: isLoading || hasErrors || !title.trim(),
isConfirming: isPublishing,
}}
>
<div className='flex flex-col gap-4'>
<FormWrapper>
<Input
required
label='Version name'
value={title}
onChange={(e) => setTitle(e.target.value)}
Expand Down

0 comments on commit 3c71aba

Please sign in to comment.