if there is no internet, keep trying every few seconds

This commit is contained in:
proddy
2026-08-23 12:23:25 +02:00
parent 91955689a2
commit c3cd4ac6b6
+12 -2
View File
@@ -1,4 +1,4 @@
import { memo, useContext, useState } from 'react';
import { memo, useContext, useEffect, useState } from 'react';
import { Link } from 'react-router';
import CancelIcon from '@mui/icons-material/Cancel';
@@ -412,7 +412,7 @@ const getPlatform = (data: VersionData): string => {
const Version = () => {
const { LL, locale } = useI18nContext();
const { me, versions } = useContext(AuthenticatedContext);
const { me, versions, refreshVersions } = useContext(AuthenticatedContext);
const [restarting, setRestarting] = useState<boolean>(false);
const [confirmFactoryReset, setConfirmFactoryReset] = useState<boolean>(false);
@@ -441,6 +441,16 @@ const Version = () => {
const devUpgradeAvailable = versions?.dev?.upgradeable ?? false;
const internetLive = Boolean(versions?.stable || versions?.dev);
useEffect(() => {
if (internetLive) {
return;
}
const interval = setInterval(() => {
void refreshVersions();
}, 3000);
return () => clearInterval(interval);
}, [internetLive, refreshVersions]);
const { send: sendSetPartition } = useRequest(
(partition: string) => callAction({ action: 'setPartition', param: partition }),
{ immediate: false }