From e031389021694ba437f4d89579bf284468a19a65 Mon Sep 17 00:00:00 2001
From: GyDi <zzzgydi@gmail.com>
Date: Wed, 23 Nov 2022 00:20:57 +0800
Subject: [PATCH] fix: close connections when profile change

---
 src/pages/profiles.tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/pages/profiles.tsx b/src/pages/profiles.tsx
index 23ea7c1..8e618f0 100644
--- a/src/pages/profiles.tsx
+++ b/src/pages/profiles.tsx
@@ -12,7 +12,7 @@ import {
   importProfile,
   enhanceProfiles,
 } from "@/services/cmds";
-import { getProxies, updateProxy } from "@/services/api";
+import { closeAllConnections, getProxies, updateProxy } from "@/services/api";
 import { atomCurrentProfile } from "@/services/states";
 import { BasePage, Notice } from "@/components/base";
 import { ProfileNew } from "@/components/profile/profile-new";
@@ -134,6 +134,7 @@ const ProfilePage = () => {
       setCurrentProfile(current);
       mutate("getProfiles", { ...profiles, current: current }, true);
       mutate("getRuntimeLogs");
+      closeAllConnections();
       Notice.success("Refresh clash config", 1000);
     } catch (err: any) {
       Notice.error(err?.message || err.toString(), 4000);
-- 
GitLab