diff --git a/app/_layout.tsx b/app/_layout.tsx index d9006f0..04c1ff2 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -485,7 +485,17 @@ function Bootstrapper({ children }: { children: React.ReactNode }) { getPrivacyAgreed(); }, []); + // 使用 ref 确保更新检查只执行一次 + const updateCheckRequestedRef = React.useRef(false); + useEffect(() => { + // 如果已经执行过更新检查,直接返回 + if (updateCheckRequestedRef.current) { + return; + } + + updateCheckRequestedRef.current = true; + async function checkUpdate() { try { logger.info(`Checking for updates..., env: ${__DEV__}, Updates.isEnabled: ${Updates.isEnabled}`);