Skip to content
Snippets Groups Projects
Unverified Commit 50270693 authored by GyDi's avatar GyDi Committed by GitHub
Browse files

fix: manage global proxy correctly

parent 57c41128
No related branches found
No related tags found
No related merge requests found
......@@ -91,8 +91,24 @@ const ProxyGlobal = (props: Props) => {
useEffect(() => {
if (groupName === "DIRECT") setNow("DIRECT");
if (groupName === "GLOBAL") setNow(curProxy || "DIRECT");
}, [groupName, curProxy]);
else if (groupName === "GLOBAL") {
if (profiles) {
const current = profiles.current;
const profile = profiles.items?.find((p) => p.uid === current);
profile?.selected?.forEach((item) => {
if (item.name === "GLOBAL") {
if (item.now && item.now !== curProxy) {
updateProxy("GLOBAL", item.now).then(() => setNow(item!.now!));
mutate("getProxies");
}
}
});
}
setNow(curProxy || "DIRECT");
}
}, [groupName, curProxy, profiles]);
return (
<>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment