a
This commit is contained in:
parent
972694e98f
commit
ba818b480d
|
|
@ -451,11 +451,11 @@ const ConfigPanel = () => {
|
|||
|
||||
useEffect(() => {
|
||||
// 如果 accountId 变化了(不是初始化),刷新页面
|
||||
if (prevAccountIdRef.current !== null && prevAccountIdRef.current !== accountId) {
|
||||
// accountId 变化时,刷新页面以确保所有状态都正确更新
|
||||
window.location.reload()
|
||||
return
|
||||
}
|
||||
// if (prevAccountIdRef.current !== null && prevAccountIdRef.current !== accountId) {
|
||||
// // accountId 变化时,刷新页面以确保所有状态都正确更新
|
||||
// window.location.reload()
|
||||
// return
|
||||
// }
|
||||
|
||||
// 初始化时,更新 ref 并加载数据
|
||||
prevAccountIdRef.current = accountId
|
||||
|
|
@ -465,13 +465,13 @@ const ConfigPanel = () => {
|
|||
loadAccountTradingStatus()
|
||||
loadCurrentAccountMeta(accountId)
|
||||
|
||||
// const timer = setInterval(() => {
|
||||
// // 定时器中使用最新的 accountId
|
||||
// loadAccountTradingStatus()
|
||||
// loadCurrentAccountMeta(accountId)
|
||||
// }, 3000)
|
||||
const timer = setInterval(() => {
|
||||
// 定时器中使用最新的 accountId
|
||||
loadAccountTradingStatus()
|
||||
loadCurrentAccountMeta(accountId)
|
||||
}, 3000)
|
||||
|
||||
// return () => clearInterval(timer)
|
||||
return () => clearInterval(timer)
|
||||
}, [accountId]) // 当 accountId 变化时,如果是切换账号则刷新页面
|
||||
|
||||
// 当accountId变化时,重新加载相关数据(避免重复调用,已在onChanged和定时器中处理)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user