fix: duplicate watch created

This commit is contained in:
jialin
2026-01-20 14:51:45 +08:00
parent d5f3158638
commit ec9a4b2607
2 changed files with 11 additions and 18 deletions
@@ -77,6 +77,7 @@ const AddWorker: React.FC<AddWorkerProps> = (props) => {
const handleOnClusterChange = async (value: number, row?: any) => {
try {
createModelsChunkRequest({ cluster_id: value });
axiosTokenRef.current?.cancel?.();
axiosTokenRef.current = createAxiosToken();
const data = await queryClusterToken(
@@ -97,21 +98,12 @@ const AddWorker: React.FC<AddWorkerProps> = (props) => {
if (open && cluster_id && firstLoad.current) {
handleOnClusterChange(cluster_id);
}
return () => {
if (!open) {
reset();
axiosTokenRef.current?.cancel?.();
firstLoad.current = true;
axiosTokenRef.current?.cancel?.();
reset();
};
}, [open, cluster_id]);
useEffect(() => {
if (open) {
createModelsChunkRequest();
} else {
reset();
axiosTokenRef.current?.cancel?.();
}
}, [open]);
}, [open, cluster_id]);
const renderMessage = (count: number) => {
if (count === 1) {