Skip to content

[fix] canvas: only finish deliveries this session watched start - #417

Merged
princepride merged 2 commits into
mainfrom
fix/regenerate-watched-jobs
Nov 21, 2026
Merged

princepride merged 2 commits into
mainfrom
fix/regenerate-watched-jobs

Conversation

@princepride

@princepride princepride commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

修复 #416 合并后在 review 中发现的回归:编辑已生成的文本节点时,节点会被误判为"收尾中",编辑器被忙碌遮罩盖住。

问题。 #416 的判断条件是"后端已交付的结果素材 ≠ 画布节点当前的 backendAssetId",对 snapshot.jobs 里所有历史任务都生效,这带来两个问题:

  • 编辑文本时被盖住。 编辑文本节点时,update-node 每次输入都会清空 backendAssetId(model.ts)。节点因此一直被判定为"收尾中":
    • GeneratingOverlay 的模糊遮罩盖住编辑器;
    • 输入框进入运行态;
    • prepareGeneration 和替换素材都被拦下;
    • 这种状态一直持续到编辑保存、项目重新读取。
  • 旧结果被当成新结果。 撤销,或在版本历史里切回旧结果时,旧任务的结果重新成为当前内容,节点也会短暂显示"收尾中",进度环直接满格。

改动。

  • jobActivities:只有节点当前确实显示着另一份后端素材时(backendAssetId 不为空且不等于交付的素材),才算在等新结果。节点没有后端素材(新建,或本地编辑过的文本)时不算。
  • useWorkspaceRuntime:只对本会话中观察到处于运行状态的任务启用"交付中"判断。历史任务、撤销或切换版本得到的结果都不会触发;如果画布刷新失败,可能卡住的也只有刚完成的那个任务。
  • 节点完全没有内容(既没有媒体也没有文字)时也算在等结果,这样首次生成时不会先闪出一个空框;有本地文字的节点不算(第 2 个提交,review 时发现第 1 个提交让首次生成丢掉了这层遮盖)。
  • 测试补充:本地编辑清空 backendAssetId 后节点不处于活动状态;空节点首次生成时处于 finishing。

Linked issue

Labels

  • Labels applied(由 PR 打标工作流处理)

Test plan

本地基于 main(0b83f97f,已包含 #416),Node.js 24。

检查 命令 结果
前端单测 node --test tests/*.test.ts 935 passed(含新增的编辑场景断言)
类型检查 tsc --noEmit 通过
静态检查 python -m pre_commit run --from-ref upstream/main --to-ref HEAD 通过
  • Left to CI: Release checks。

Evidence that it works

在本地部署上用无头 Chromium 验证(每 50ms 记录节点 <img> 和忙碌遮罩):

  • 首次生成:遮罩一直保持到图片出现(1.74 s),中间没有空框。第 1 个提交时这里有 0.11 s 的空框。

  • 重新生成:遮罩一直保持到新图出现(2.0 s),没有旧图闪回。

  • 文本节点:在同一次会话里生成后(4 s),双击编辑并输入 5 个字符,期间遮罩一次都没有出现。

  • 以上为无头浏览器的逐帧记录,未附截图。

Provider verification

  • 没有调用任何模型服务。

Bilingual UI

  • 没有新增或修改界面文案。

🤖 Generated with Claude Code

Review findings: editing a generated text node clears its backend asset on
every keystroke, which made the node look like it was still waiting for its
result and covered the editor with the busy overlay. Undo or a version switch
also made an old job's result count as "arriving". A node now waits only
while it still shows an older backend asset, and only for jobs this session
saw running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added area:canvas Canvas, nodes and direct manipulation type:bug Something is broken labels Nov 20, 2026
Requiring a displayed backend asset excluded locally edited text, but also
excluded a first generation into an empty node, which again flashed an empty
frame between the job finishing and the result loading. An empty node (no
media, no text) now waits too; a node with local text still does not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@princepride
princepride merged commit 84d1211 into main Nov 21, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:canvas Canvas, nodes and direct manipulation type:bug Something is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant