From 2247640dc1dc2d6e9539b72efc3a7260545ebec6 Mon Sep 17 00:00:00 2001 From: Purp1e <47248616+Purple-CSGO@users.noreply.github.com> Date: Sun, 23 Mar 2025 01:14:47 +0800 Subject: [PATCH] [fix] unneccessary loading ending before pushing home page --- src/components/cstb/Prepare.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/cstb/Prepare.tsx b/src/components/cstb/Prepare.tsx index 93877f0..18227c7 100644 --- a/src/components/cstb/Prepare.tsx +++ b/src/components/cstb/Prepare.tsx @@ -52,16 +52,18 @@ export function Prepare() { trailing: true, maxWait: 2500, }) + const [checkCount, setCheckCount] = useState(0) useEffect(() => { + setCheckCount((prev) => (prev >= 10 ? 10 : prev + 1)) // console.log(checkCount, "触发", debounceValid, steam.state.steamDir, steam.state.cs2Dir) - if (debounceValid && app.state.inited) { + if (checkCount < 2 && debounceValid && app.state.inited) { setTimeout(() => { router.push("/home") - }, 500) + }, 800) } else { setTimeout(() => { setLoading(false) - }, 800) + }, 1000) } }, [debounceValid])