@@ -6,7 +6,6 @@ import { Controller, useForm } from "react-hook-form";
66
77import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider" ;
88import { WEBSITE_URL , IS_SELF_HOSTED } from "@calcom/lib/constants" ;
9- import slugify from "@calcom/lib/slugify" ;
109import { trpc } from "@calcom/trpc/react" ;
1110import type { AppRouter } from "@calcom/trpc/types/server/routers/_app" ;
1211
@@ -42,9 +41,7 @@ export const UsernameAvailability = (props: ICustomUsernameProps) => {
4241 const { isPremium, disabled, ...otherProps } = props ;
4342 const UsernameAvailabilityComponent = isPremium ? PremiumTextfield : UsernameTextfield ;
4443 // PremiumTextfield uses `readonly` prop, UsernameTextfield uses `disabled` prop
45- const componentProps = isPremium
46- ? { ...otherProps , readonly : disabled }
47- : { ...otherProps , disabled } ;
44+ const componentProps = isPremium ? { ...otherProps , readonly : disabled } : { ...otherProps , disabled } ;
4845 return < UsernameAvailabilityComponent { ...componentProps } /> ;
4946} ;
5047
@@ -63,7 +60,7 @@ export const UsernameAvailabilityField = ({
6360 : { username : currentUsernameState || "" , setQuery : setCurrentUsernameState } ;
6461 const formMethods = useForm ( {
6562 defaultValues : {
66- username : slugify ( currentUsername || user . username || "" ) ,
63+ username : currentUsername ,
6764 } ,
6865 } ) ;
6966
@@ -85,11 +82,7 @@ export const UsernameAvailabilityField = ({
8582 setCurrentUsername = { setCurrentUsername }
8683 inputUsernameValue = { value }
8784 usernameRef = { ref }
88- setInputUsernameValue = { ( val ) => {
89- const displayValue = slugify ( val , true ) ;
90- formMethods . setValue ( "username" , displayValue ) ;
91- onChange ?.( displayValue ) ;
92- } }
85+ setInputUsernameValue = { onChange }
9386 onSuccessMutation = { onSuccessMutation }
9487 onErrorMutation = { onErrorMutation }
9588 disabled = { disabled ?? ! ! user . organization ?. id }
0 commit comments