fix(service): avoid sticky availability probes

This commit is contained in:
wonfen
2026-07-25 15:22:46 +08:00
parent 7796259b03
commit e599a9d02c
10 changed files with 68 additions and 203 deletions
+1 -8
View File
@@ -7,11 +7,8 @@ import {
supportedLanguages,
} from '@/services/i18n'
import { useVerge } from './use-verge'
export const useI18n = () => {
const { i18n, t } = useTranslation()
const { patchVerge } = useVerge()
const [isLoading, setIsLoading] = useState(false)
const switchLanguage = useCallback(
@@ -30,17 +27,13 @@ export const useI18n = () => {
setIsLoading(true)
try {
await changeLanguage(targetLanguage)
if (patchVerge) {
await patchVerge({ language: targetLanguage })
}
} catch (error) {
console.error('Failed to change language:', error)
} finally {
setIsLoading(false)
}
},
[i18n.language, patchVerge],
[i18n.language],
)
return {