diff --git a/src/components/profile/profile-new.tsx b/src/components/profile/profile-new.tsx index bd2a5e8..336432b 100644 --- a/src/components/profile/profile-new.tsx +++ b/src/components/profile/profile-new.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import { Button, Dialog, @@ -28,6 +28,13 @@ const ProfileNew = (props: Props) => { onSubmit(name, desc); }; + useEffect(() => { + if (!open) { + setName(""); + setDesc(""); + } + }, [open]); + return ( Create Profile diff --git a/src/pages/profiles.tsx b/src/pages/profiles.tsx index 3f75eb0..4996df2 100644 --- a/src/pages/profiles.tsx +++ b/src/pages/profiles.tsx @@ -104,8 +104,8 @@ const ProfilePage = () => { try { await newProfile(name, desc); - mutate("getProfiles"); setDialogOpen(false); + mutate("getProfiles"); } catch (err: any) { err && Notice.error(err.toString()); } finally {