Fix(Tool): Fix the bug that can not load when switch between two tools

Fix the bug that can not load when switch between two tools. Optimize navigate when can not find tool.
This commit is contained in:
2024-05-01 13:41:27 +08:00
parent 2f9c01981b
commit 59eef73895
4 changed files with 9 additions and 19 deletions

View File

@@ -62,9 +62,7 @@ const Code = () => {
break
case DATABASE_NO_RECORD_FOUND:
void message.error('未找到指定工具')
setTimeout(() => {
navigateToRepository(navigate)
}, 3000)
break
default:
void message.error('获取工具信息失败,请稍后重试')
@@ -78,7 +76,7 @@ const Code = () => {
useEffect(() => {
getTool()
}, [])
}, [id])
return (
<>

View File

@@ -51,9 +51,7 @@ const Execute = () => {
break
case DATABASE_NO_RECORD_FOUND:
void message.error('未找到指定工具')
setTimeout(() => {
navigateToTools(navigate)
}, 3000)
break
default:
void message.error('获取工具信息失败,请稍后重试')
@@ -67,7 +65,7 @@ const Execute = () => {
useEffect(() => {
getTool()
}, [])
}, [id])
return (
<FitFullscreen data-component={'system-tools-execute'}>

View File

@@ -258,9 +258,7 @@ const Edit = () => {
break
case DATABASE_NO_RECORD_FOUND:
void message.error('未找到指定工具')
setTimeout(() => {
navigateToRepository(navigate)
}, 3000)
break
default:
void message.error('获取工具信息失败,请稍后重试')
@@ -327,7 +325,7 @@ const Edit = () => {
return
}
getTool()
}, [])
}, [toolId, searchParams])
const drawerToolbar = (
<AntdSpace>

View File

@@ -49,9 +49,7 @@ const Source = () => {
break
case DATABASE_NO_RECORD_FOUND:
void message.error('未找到指定工具')
setTimeout(() => {
navigateToRepository(navigate)
}, 3000)
break
default:
void message.error('获取工具信息失败,请稍后重试')
@@ -70,9 +68,7 @@ const Source = () => {
return
}
if (username === '!' && !getLoginStatus()) {
setTimeout(() => {
navigateToRepository(navigate)
}, 3000)
return
}
if (username !== '!' && ver) {
@@ -84,7 +80,7 @@ const Source = () => {
return
}
getTool()
}, [])
}, [username, toolId, ver, searchParams])
return (
<FitFullscreen data-component={'tools-source'}>