This commit is contained in:
薇薇安 2026-01-21 13:19:10 +08:00
parent c28400e51e
commit 9bc73b63a3

View File

@ -33,12 +33,14 @@ const AccountSelector = ({ onChanged }) => {
return acc return acc
}, []) }, [])
const optionsKey = options.map((x) => x.id).join(',')
useEffect(() => { useEffect(() => {
if (!options.length) return if (!options.length) return
if (options.some((a) => a.id === accountId)) return if (options.some((a) => a.id === accountId)) return
setAccountId(options[0].id) setAccountId(options[0].id)
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [options.length]) }, [optionsKey, accountId])
return ( return (
<div className="nav-account"> <div className="nav-account">