feat(app): 优化Expo Updates更新检查机制,防止重复执行
This commit is contained in:
@@ -485,7 +485,17 @@ function Bootstrapper({ children }: { children: React.ReactNode }) {
|
|||||||
getPrivacyAgreed();
|
getPrivacyAgreed();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// 使用 ref 确保更新检查只执行一次
|
||||||
|
const updateCheckRequestedRef = React.useRef(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// 如果已经执行过更新检查,直接返回
|
||||||
|
if (updateCheckRequestedRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCheckRequestedRef.current = true;
|
||||||
|
|
||||||
async function checkUpdate() {
|
async function checkUpdate() {
|
||||||
try {
|
try {
|
||||||
logger.info(`Checking for updates..., env: ${__DEV__}, Updates.isEnabled: ${Updates.isEnabled}`);
|
logger.info(`Checking for updates..., env: ${__DEV__}, Updates.isEnabled: ${Updates.isEnabled}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user