|
@@ -1,12 +1,22 @@
|
|
-import useSWR from "swr";
|
|
|
|
|
|
+import useSWR, { useSWRConfig } from "swr";
|
|
|
|
+import { useEffect } from "react";
|
|
import { Box, List, Paper, Typography } from "@mui/material";
|
|
import { Box, List, Paper, Typography } from "@mui/material";
|
|
import { getProxies } from "../services/api";
|
|
import { getProxies } from "../services/api";
|
|
import ProxyGroup from "../components/proxy-group";
|
|
import ProxyGroup from "../components/proxy-group";
|
|
|
|
|
|
const ProxyPage = () => {
|
|
const ProxyPage = () => {
|
|
|
|
+ const { mutate } = useSWRConfig();
|
|
const { data: proxiesData } = useSWR("getProxies", getProxies);
|
|
const { data: proxiesData } = useSWR("getProxies", getProxies);
|
|
const { groups = [] } = proxiesData ?? {};
|
|
const { groups = [] } = proxiesData ?? {};
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ // fix the empty proxies on the first sight
|
|
|
|
+ // this bud only show on the build version
|
|
|
|
+ // call twice to avoid something unknown or the delay of the clash startup
|
|
|
|
+ setTimeout(() => mutate("getProxies"), 250);
|
|
|
|
+ setTimeout(() => mutate("getProxies"), 1000);
|
|
|
|
+ }, []);
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<Box sx={{ width: 0.9, maxWidth: "850px", mx: "auto", mb: 2 }}>
|
|
<Box sx={{ width: 0.9, maxWidth: "850px", mx: "auto", mb: 2 }}>
|
|
<Typography variant="h4" component="h1" sx={{ py: 2 }}>
|
|
<Typography variant="h4" component="h1" sx={{ py: 2 }}>
|