fix(usage): 解耦活跃请求轮询与全局刷新逻辑

1秒轮询始终用于活跃请求的实时更新,不再受全局刷新状态影响
This commit is contained in:
fawney19
2026-01-15 12:19:46 +08:00
parent 76f648b4eb
commit abe65ad01b

View File

@@ -322,9 +322,9 @@ function stopAutoRefresh() {
}
// 监听活跃请求状态,自动启动/停止刷新
// 注意全局刷新开启时不需要1秒轮询全局刷新已经包含完整数据刷新
// 1秒轮询始终用于活跃请求的实时更新不受全局刷新影响
watch(hasActiveRequests, (hasActive) => {
if (hasActive && !globalAutoRefresh.value) {
if (hasActive) {
startAutoRefresh()
} else {
stopAutoRefresh()
@@ -349,16 +349,10 @@ function stopGlobalAutoRefresh() {
function handleAutoRefreshChange(value: boolean) {
globalAutoRefresh.value = value
if (value) {
// 开启全局刷新时停止1秒轮询避免重复请求
stopAutoRefresh()
refreshData() // 立即刷新一次
startGlobalAutoRefresh()
} else {
stopGlobalAutoRefresh()
// 关闭全局刷新后如果有活跃请求恢复1秒轮询
if (hasActiveRequests.value) {
startAutoRefresh()
}
}
}