mirror of
https://github.com/cs-lazy-tools/ChatGPT-On-CS.git
synced 2026-08-30 17:06:37 +08:00
fix: 超时的问题
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
如果网络环境导致下载不了,可以使用百度云盘下载:
|
||||
|
||||
```txt
|
||||
链接:https://pan.baidu.com/s/1PgWOvgMoG6eh5nBIr7R-SA?pwd=6666
|
||||
链接:https://pan.baidu.com/s/18YYfc45isZoO9Dq6P7dRgA?pwd=6666
|
||||
提取码:6666
|
||||
```
|
||||
|
||||
|
||||
@@ -51,7 +51,27 @@ export const useAppManager = (): AppManagerContextType => {
|
||||
};
|
||||
|
||||
const usePlatformList = () => {
|
||||
return useQuery(['platformList'], getPlatformList);
|
||||
const [retryCount, setRetryCount] = useState(0);
|
||||
|
||||
const { data, error, refetch, isLoading } = useQuery(
|
||||
['platformList'],
|
||||
getPlatformList,
|
||||
{
|
||||
retry: false, // 禁用 react-query 内置的重试机制
|
||||
},
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if ((data?.data?.length === 0 || !data) && retryCount < 5) {
|
||||
const timer = setTimeout(() => {
|
||||
setRetryCount(retryCount + 1);
|
||||
refetch();
|
||||
}, 2000);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
}, [data, retryCount, refetch]);
|
||||
|
||||
return { data, isLoading, error, retryCount };
|
||||
};
|
||||
|
||||
const useTaskList = () => {
|
||||
|
||||
Reference in New Issue
Block a user