fix: handle non-array response when fetching Mihomo tags

This commit is contained in:
Memory 2025-12-08 13:06:07 +08:00 committed by GitHub
parent 392285058e
commit 7619b4d3e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -324,9 +324,10 @@ const Mihomo: React.FC = () => {
setLoadingTags(true)
try {
const data = await fetchMihomoTags(forceRefresh)
setTags(data)
setTags(Array.isArray(data) ? data : [])
} catch (error) {
console.error('Failed to fetch tags:', error)
setTags([])
alert(t('mihomo.error.fetchTagsFailed'))
} finally {
setLoadingTags(false)