mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: validate project names on blur (#7668)
This fix validates the project name when you blur the field in the new project form. The only instances where it'll be wrong is if you have just whitespace or an empty string, but you'll be notified immediately. Also removes some unused variables and parameters that I found.
This commit is contained in:
		
							parent
							
								
									dc37503b7d
								
							
						
					
					
						commit
						2c41cbbd3c
					
				| @ -128,7 +128,6 @@ export const CreateProjectDialog = ({ | |||||||
|     const navigate = useNavigate(); |     const navigate = useNavigate(); | ||||||
|     const { trackEvent } = usePlausibleTracker(); |     const { trackEvent } = usePlausibleTracker(); | ||||||
|     const { |     const { | ||||||
|         projectId, |  | ||||||
|         projectName, |         projectName, | ||||||
|         projectDesc, |         projectDesc, | ||||||
|         projectMode, |         projectMode, | ||||||
| @ -276,6 +275,7 @@ export const CreateProjectDialog = ({ | |||||||
|                     errors={errors} |                     errors={errors} | ||||||
|                     icon={StyledProjectIcon} |                     icon={StyledProjectIcon} | ||||||
|                     onClose={onClose} |                     onClose={onClose} | ||||||
|  |                     validateName={validateName} | ||||||
|                     configButtons={ |                     configButtons={ | ||||||
|                         <> |                         <> | ||||||
|                             <MultiSelectConfigButton |                             <MultiSelectConfigButton | ||||||
|  | |||||||
| @ -86,14 +86,12 @@ function resolveCreateButtonData( | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const ProjectCreationButton: FC<{ projectCount: number }> = ({ | const ProjectCreationButton: FC = () => { | ||||||
|     projectCount, |  | ||||||
| }) => { |  | ||||||
|     const [searchParams] = useSearchParams(); |     const [searchParams] = useSearchParams(); | ||||||
|     const showCreateDialog = Boolean(searchParams.get('create')); |     const showCreateDialog = Boolean(searchParams.get('create')); | ||||||
|     const [openCreateDialog, setOpenCreateDialog] = useState(showCreateDialog); |     const [openCreateDialog, setOpenCreateDialog] = useState(showCreateDialog); | ||||||
|     const { hasAccess } = useContext(AccessContext); |     const { hasAccess } = useContext(AccessContext); | ||||||
|     const { isOss, uiConfig, loading } = useUiConfig(); |     const { isOss, loading } = useUiConfig(); | ||||||
| 
 | 
 | ||||||
|     const createButtonData = resolveCreateButtonData( |     const createButtonData = resolveCreateButtonData( | ||||||
|         isOss(), |         isOss(), | ||||||
| @ -203,9 +201,7 @@ export const ProjectListNew = () => { | |||||||
|                                     </> |                                     </> | ||||||
|                                 } |                                 } | ||||||
|                             /> |                             /> | ||||||
|                             <ProjectCreationButton |                             <ProjectCreationButton /> | ||||||
|                                 projectCount={projects.length} |  | ||||||
|                             /> |  | ||||||
|                         </> |                         </> | ||||||
|                     } |                     } | ||||||
|                 > |                 > | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user