Skip to content

Commit 4d1d116

Browse files
authored
fix(web): updating workspace name setting (#1646)
1 parent e8480e3 commit 4d1d116

File tree

1 file changed

+12
-12
lines changed
  • web/src/beta/features/WorkspaceSetting/innerPages/Workspaces

1 file changed

+12
-12
lines changed

web/src/beta/features/WorkspaceSetting/innerPages/Workspaces/index.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,18 @@ type Props = {
2121
const 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

Comments
 (0)