@@ -21,17 +21,18 @@ type Props = {
2121const WorkspaceSetting : FC < Props > = ( { workspace } ) => {
2222 const t = useT ( ) ;
2323
24- const [ localWorkspaceName , setLocalWorkspaceName ] = useState < string > (
25- workspace ?. name ?? ""
26- ) ;
27-
2824 const { useUpdateWorkspace : updateWorkspace } = useWorkspaceFetcher ( ) ;
29- const handleSubmitUpdateWorkspaceName = useCallback ( async ( ) => {
30- await updateWorkspace ( {
31- teamId : workspace ?. id ?? "" ,
32- name : localWorkspaceName
33- } ) ;
34- } , [ workspace , localWorkspaceName , updateWorkspace ] ) ;
25+
26+ const handleSubmitUpdateWorkspaceName = useCallback (
27+ ( name : string ) => {
28+ if ( ! workspace ?. id ) return ;
29+ updateWorkspace ( {
30+ teamId : workspace . id ,
31+ name
32+ } ) ;
33+ } ,
34+ [ workspace , updateWorkspace ]
35+ ) ;
3536
3637 const { useProjectsQuery } = useProjectFetcher ( ) ;
3738 const { projects } = useProjectsQuery ( {
@@ -74,8 +75,7 @@ const WorkspaceSetting: FC<Props> = ({ workspace }) => {
7475 </ TitleWrapper >
7576 < InputField
7677 title = { t ( "Workspace Name" ) }
77- value = { localWorkspaceName }
78- onChange = { setLocalWorkspaceName }
78+ value = { workspace ?. name }
7979 appearance = { workspace ?. personal ? "readonly" : undefined }
8080 disabled = { ! ! workspace ?. personal || meRole !== Role . Owner }
8181 onChangeComplete = { handleSubmitUpdateWorkspaceName }
0 commit comments