diff --git a/src/pages/rules.tsx b/src/pages/rules.tsx
index 7e4f250ded8706d5c9ce384cbf0600d13023259b..9c2547f6999d4f7e6ac7dc12b8d4dffad3baa2e6 100644
--- a/src/pages/rules.tsx
+++ b/src/pages/rules.tsx
@@ -10,6 +10,7 @@ import {
 } from "../services/command";
 import ProfileItemComp from "../components/profile-item";
 import useNotice from "../utils/use-notice";
+import noop from "../utils/noop";
 
 const RulesPage = () => {
   const [url, setUrl] = useState("");
@@ -19,14 +20,21 @@ const RulesPage = () => {
   const { mutate } = useSWRConfig();
   const { data: profiles = {} } = useSWR("getProfiles", getProfiles);
 
-  const onClick = () => {
+  const onImport = async () => {
     if (!url) return;
     setUrl("");
     setDisabled(true);
-    importProfile(url)
-      .then(() => notice.success("Successfully import profile."))
-      .catch(() => notice.error("Failed to import profile."))
-      .finally(() => setDisabled(false));
+
+    try {
+      await importProfile(url);
+      mutate("getProfiles", getProfiles());
+      if (!profiles.items?.length) putProfiles(0).catch(noop);
+      notice.success("Successfully import profile.");
+    } catch {
+      notice.error("Failed to import profile.");
+    } finally {
+      setDisabled(false);
+    }
   };
 
   const lockRef = useRef(false);
@@ -76,7 +84,7 @@ const RulesPage = () => {
         <Button
           disabled={!url || disabled}
           variant="contained"
-          onClick={onClick}
+          onClick={onImport}
         >
           Import
         </Button>
diff --git a/src/services/command.ts b/src/services/command.ts
index a5e93277ae0b2251a2cc9729ff2c380afa203f75..d6d3c360d54cec8fa78fef080b7147763b7015c4 100644
--- a/src/services/command.ts
+++ b/src/services/command.ts
@@ -48,7 +48,7 @@ export interface ProfilesConfig {
 }
 
 export async function getProfiles() {
-  return invoke<ProfilesConfig | null>("get_profiles");
+  return (await invoke<ProfilesConfig>("get_profiles")) ?? {};
 }
 
 export async function setProfiles(current: number, profile: ProfileItem) {