Skip to content

fix(web): prevent tree item version conflicts and enhance recovery - #47

Merged
IGNGserver merged 1 commit into
masterfrom
agent/fix-tree-version-conflict
Oct 30, 2026
Merged

IGNGserver merged 1 commit into
masterfrom
agent/fix-tree-version-conflict

Conversation

@IGNGserver

Copy link
Copy Markdown
Owner

变更内容

  • 统一最新版本投影:在目录项排序(moveWithinStatus)、单任务删除(deleteTask)、批量删除(deleteSelected)等操作中,统一通过 latestItem / displayTask 消费乐观状态中的最新版本与状态,防止由于旧版本号提交触发后端的 VERSION_CONFLICT。
  • 冲突自愈处理:增加 handleTreeMutationError,当捕获到实体版本、状态或排序锚点冲突时,自动触发 load() 重新拉取服务端最新数据,并友好提示“数据版本已被更新,已自动同步最新状态,请重试”,消除界面卡死。
  • 清理本地覆盖保护:在后台数据刷新时,仅当服务端返回的数据版本赶上或超过本地覆盖版本时才清除对应项的 override,避免竞态导致版本倒退。

验证结果

  • pnpm --filter @devtodo/web typecheck:通过(0 错误)
  • vitest run test:通过(22 个测试套件,134 项测试全部通过)
  • pnpm lint:通过(eslint 0 警告)
  • pnpm tokens:check:通过

Ensure directory operations (reordering, single/batch deletion, and status changes)
always consume the latest entity version and status from optimistic state projections.
Gracefully handle version conflicts by triggering background synchronization and clear
local optimistic overrides only when server responses reflect up-to-date revisions.

Assisted-by: opencode/gemini-3.8-flash
@IGNGserver
IGNGserver merged commit 69689c5 into master Oct 30, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant