[P1-13] 🟡 RunHistory 面板增加轮询(手动按钮 + 自动开关) #12

Closed
opened 2026-08-20 14:28:00 +08:00 by tao.chen · 0 comments
Owner

背景

RunHistory 面板目前没有显式轮询入口,只有点开/切换 schedule 时的一次性 fetch。
长跑场景下用户开了面板等结果,几分钟后没动静就不知道是没跑、跑了没上报、还是 UI 没刷新——体验差。
P0 #2 修了"轮询 effect 反复重建",P1 #3 删了"冗余 runs 订阅",但轮询本身没接通

修复

  • <RunHistory /> 顶部加手动"刷新"按钮 + 状态点(active/idle)
  • 增加 useScheduleRunsPolling(scheduleId, triggerType, enabled) hook(沿用 refreshRuns,5s 间隔,enabled prop 默认 false 用户点开关才轮询)
  • 轮询状态接入 <RunsIndicator /> 小组件,显示"自动刷新 5s"
  • 切换 schedule / 关闭面板时立刻 clearInterval(已有的 effect cleanup 路径)

验收

  • 触发一次 schedule 后,5s 内 RunHistory 出现新行,无需手动刷
  • 切到别的 schedule 回来,自动轮询仅在新 schedule 上启动
  • 关闭/卸载 RunHistory 后无残留 setInterval
  • React DevTools Profiler:轮询期间 SchedulePage 不 commit(轮询应只走 RunHistory 内部 store 订阅)

引用

frontend/app/features/schedules/SchedulePage.tsx:259 setInterval / useSchedulesStore runs / RunHistory.tsx


Task: e8cnther8io6f08q02klw5w4

## 背景 RunHistory 面板目前**没有**显式轮询入口,只有点开/切换 schedule 时的一次性 fetch。 长跑场景下用户开了面板等结果,几分钟后没动静就不知道是没跑、跑了没上报、还是 UI 没刷新——体验差。 P0 #2 修了"轮询 effect 反复重建",P1 #3 删了"冗余 runs 订阅",但**轮询本身没接通**。 ## 修复 - [ ] `<RunHistory />` 顶部加手动"刷新"按钮 + 状态点(active/idle) - [ ] 增加 `useScheduleRunsPolling(scheduleId, triggerType, enabled)` hook(沿用 `refreshRuns`,5s 间隔,`enabled` prop 默认 false 用户点开关才轮询) - [ ] 轮询状态接入 `<RunsIndicator />` 小组件,显示"自动刷新 5s" - [ ] 切换 schedule / 关闭面板时立刻 clearInterval(已有的 effect cleanup 路径) ## 验收 - [ ] 触发一次 schedule 后,5s 内 RunHistory 出现新行,无需手动刷 - [ ] 切到别的 schedule 回来,自动轮询仅在新 schedule 上启动 - [ ] 关闭/卸载 RunHistory 后无残留 setInterval - [ ] React DevTools Profiler:轮询期间 SchedulePage 不 commit(轮询应只走 RunHistory 内部 store 订阅) ## 引用 `frontend/app/features/schedules/SchedulePage.tsx:259` setInterval / `useSchedulesStore` runs / `RunHistory.tsx` --- <sub>Task: e8cnther8io6f08q02klw5w4</sub>
tao.chen added the priority:mediumstatus:to-do labels 2026-08-20 14:28:02 +08:00
tao.chen added status:in-review and removed status:to-do labels 2026-08-24 14:24:02 +08:00
tao.chen added status:donestatus:archived and removed status:in-review labels 2026-08-24 14:25:25 +08:00
tao.chen reopened this issue 2026-08-24 14:25:35 +08:00
tao.chen added the status:to-do label 2026-08-24 14:26:01 +08:00
tao.chen removed the status:to-do label 2026-08-24 14:49:59 +08:00
tao.chen removed the status:done label 2026-08-24 14:50:26 +08:00
tao.chen reopened this issue 2026-08-24 14:50:27 +08:00
tao.chen added the status:to-do label 2026-08-24 14:50:39 +08:00
tao.chen removed the status:to-do label 2026-08-24 14:50:48 +08:00
tao.chen reopened this issue 2026-08-24 14:50:48 +08:00
tao.chen reopened this issue 2026-08-24 14:51:07 +08:00
tao.chen added the status:done label 2026-08-24 14:51:10 +08:00
tao.chen removed the status:done label 2026-08-24 14:51:28 +08:00
tao.chen reopened this issue 2026-08-24 14:51:30 +08:00
tao.chen added the status:to-do label 2026-08-24 14:51:59 +08:00
tao.chen added status:done and removed status:to-do labels 2026-08-24 14:55:02 +08:00
tao.chen added status:in-review and removed status:done labels 2026-08-24 14:55:21 +08:00
tao.chen reopened this issue 2026-08-24 14:55:25 +08:00
tao.chen added status:to-do and removed status:in-review labels 2026-08-24 14:55:32 +08:00
tao.chen added status:in-review and removed status:to-do labels 2026-08-25 19:17:06 +08:00
tao.chen added status:done and removed status:in-review labels 2026-08-27 18:54:08 +08:00
Sign in to join this conversation.