From 3c71aba32dea4f70326873c89e23c22b8f35e746 Mon Sep 17 00:00:00 2001 From: Gerard Clos Date: Wed, 20 Nov 2024 12:53:23 +0100 Subject: [PATCH] quickfix: do not allow empty commit title --- .../Sidebar/PublishDraftCommitModal/index.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/_components/Sidebar/PublishDraftCommitModal/index.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/_components/Sidebar/PublishDraftCommitModal/index.tsx index 86040781d..4f6987534 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/_components/Sidebar/PublishDraftCommitModal/index.tsx +++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/_components/Sidebar/PublishDraftCommitModal/index.tsx @@ -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.' @@ -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, }} >
setTitle(e.target.value)}