From 41edb07a5ddd526314265c5fe10a3d30ae9ec296 Mon Sep 17 00:00:00 2001 From: Logan Yang Date: Sat, 31 May 2025 16:36:12 -0700 Subject: [PATCH] Allow project name to have spaces (#1503) --- src/components/modals/AddProjectModal.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/modals/AddProjectModal.tsx b/src/components/modals/AddProjectModal.tsx index f8e3c8b7..35988416 100644 --- a/src/components/modals/AddProjectModal.tsx +++ b/src/components/modals/AddProjectModal.tsx @@ -64,8 +64,8 @@ function AddProjectModalContent({ initialProject, onSave, onCancel }: AddProject setFormData((prev) => { // Handle text input if (typeof value === "string") { - // Only trim for specific fields that shouldn't have whitespace - if (field === "name" || field === "projectModelKey") { + // Only trim for model key which shouldn't have whitespace + if (field === "projectModelKey") { value = value.trim(); } } @@ -97,6 +97,11 @@ function AddProjectModalContent({ initialProject, onSave, onCancel }: AddProject }; const handleSave = async () => { + // Trim the project name before validation and saving + if (formData.name) { + formData.name = formData.name.trim(); + } + const requiredFields = ["name", "projectModelKey"]; const missingFields = requiredFields.filter((field) => !formData[field as keyof ProjectConfig]);