static/app.js 两个问题:
),导致 scrollTop 归零后再 scrollTop=scrollHeight,因 CSS scroll-behavior:smooth + layout 未完成而表现为先回到顶部再到底部,且若用户曾向上滚动查看历史也会被强制拉回底部。
被重置为 display:none,按钮文字也被重置为"查看日志"。
期望行为:
.textContent。
Task: fumwhk1zoqb4033a0dj6u2z7
tao.chen commented:
实施 & 验证
变更范围: 仅 static/app.js(255 → 299 行,+65/-20)。
static/app.js
关键改动:
state
expandedLogs: Set<id>
lastLiveKey
renderRunning()
state.lastLiveKey !== liveKey
innerHTML
#running-body
#live-log.textContent
distanceFromBottom = scrollHeight - scrollTop - clientHeight
scrollTop = scrollHeight
#log-autoscroll
#live-log
renderHistory()
state.expandedLogs
<pre>
.toggle-log
data-id="${r.id}"
验证:
node --check static/app.js
go build .
embed.FS
app.js
pollQueue
body.innerHTML
dFB=640
scrollTop
dFB=40
dFB=20
expandedLogs
data-id
No dependencies set.
The note is not visible to the blocked user.
static/app.js 两个问题:
期望行为:
Task: fumwhk1zoqb4033a0dj6u2z7
tao.chen commented:
变更范围: 仅
static/app.js(255 → 299 行,+65/-20)。关键改动:
state新增expandedLogs: Set<id>与lastLiveKey两个字段。renderRunning()在state.lastLiveKey !== liveKey时才用innerHTML重建#running-body;同一任务仅更新#live-log.textContent,DOM 节点稳定。distanceFromBottom = scrollHeight - scrollTop - clientHeight,≤24 视为贴底,在 rAF 中scrollTop = scrollHeight;否则保留用户位置。#log-autoscroll按钮开启时,在 rAF 中立即把#live-log滚到底。renderHistory()用state.expandedLogs作为单一事实源,re-render 后按集合恢复<pre>显示与按钮文字;.toggle-log按钮新增data-id="${r.id}"。验证:
node --check static/app.js→ 通过go build .→ 通过(embed.FS已重新嵌入更新后的app.js)pollQueue,body.innerHTML重建次数 = 0dFB=640)后再轮询,scrollTop保持 0,不被拉回dFB=40(>24)时不滚动;dFB=20(≤24)时贴底expandedLogsSet 在 renderHistory 中完整使用,toggle-log 按钮已暴露data-id,re-render 后恢复展开/收起状态