1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +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:
Thomas Heartman 2024-07-25 14:43:38 +02:00 committed by GitHub
parent dc37503b7d
commit 2c41cbbd3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 8 deletions

View File

@ -128,7 +128,6 @@ export const CreateProjectDialog = ({
const navigate = useNavigate();
const { trackEvent } = usePlausibleTracker();
const {
projectId,
projectName,
projectDesc,
projectMode,
@ -276,6 +275,7 @@ export const CreateProjectDialog = ({
errors={errors}
icon={StyledProjectIcon}
onClose={onClose}
validateName={validateName}
configButtons={
<>
<MultiSelectConfigButton

View File

@ -86,14 +86,12 @@ function resolveCreateButtonData(
}
}
const ProjectCreationButton: FC<{ projectCount: number }> = ({
projectCount,
}) => {
const ProjectCreationButton: FC = () => {
const [searchParams] = useSearchParams();
const showCreateDialog = Boolean(searchParams.get('create'));
const [openCreateDialog, setOpenCreateDialog] = useState(showCreateDialog);
const { hasAccess } = useContext(AccessContext);
const { isOss, uiConfig, loading } = useUiConfig();
const { isOss, loading } = useUiConfig();
const createButtonData = resolveCreateButtonData(
isOss(),
@ -203,9 +201,7 @@ export const ProjectListNew = () => {
</>
}
/>
<ProjectCreationButton
projectCount={projects.length}
/>
<ProjectCreationButton />
</>
}
>