diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index 2ce09f2..5883d62 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -163,9 +163,10 @@ const configFormSchema = z.object({ 'mixed-port': z.number(), }) -const ConfigForm: ParentComponent<{ isSingBox: Accessor }> = ({ - isSingBox, -}) => { +const ConfigForm: ParentComponent<{ + isSingBox: Accessor + fetchBackendVersion: () => Promise +}> = ({ isSingBox, fetchBackendVersion }) => { const [t] = useI18n() const portList = [ @@ -408,7 +409,10 @@ const ConfigForm: ParentComponent<{ isSingBox: Accessor }> = ({ @@ -527,9 +531,12 @@ const Versions: Component<{ const [isFrontendUpdateAvailable] = createResource(() => isFrontendUpdateAvailableAPI(frontendVersion), ) - const [isBackendUpdateAvailable] = createResource(() => - isBackendUpdateAvailableAPI(backendVersion()), - ) + const [isBackendUpdateAvailable, { refetch: fetchIsBackendUpdateAvailable }] = + createResource(() => isBackendUpdateAvailableAPI(backendVersion())) + + createEffect(() => { + fetchIsBackendUpdateAvailable() + }, backendVersion()) const UpdateAvailableIndicator = () => ( @@ -571,9 +578,10 @@ export default () => { const [t] = useI18n() const frontendVersion = `v${import.meta.env.APP_VERSION}` - const [backendVersion] = createResource(fetchBackendVersionAPI, { - initialValue: '', - }) + const [backendVersion, { refetch: fetchBackendVersion }] = createResource( + fetchBackendVersionAPI, + { initialValue: '' }, + ) const isSingBox = createMemo( () => backendVersion()?.includes('sing-box') || false, @@ -592,7 +600,12 @@ export default () => { {t('coreConfig')} - + + fetchBackendVersion() as unknown as Promise + } + /> {t('xdConfig')}