Skip to content

fix(quick-edit): reload the latest version on edit conflict - #70

Merged
dragon-fish merged 1 commit into
masterfrom
fix/quick-edit-conflict
Dec 3, 2026
Merged

dragon-fish merged 1 commit into
masterfrom
fix/quick-edit-conflict

Conversation

@dragon-fish

@dragon-fish dragon-fish commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

基于 #69,等它合并后再 rebase 到 master。

问题

快速编辑遇到 editconflict 后会提示“再次提交即可忽略警告”,但再次提交时仍然带着旧的 basetimestamp,只要 MediaWiki 没能自动合并,就会一直冲突。真正生效的只有新建页面那条路径(改用 recreate 提交),而它本身只是为了绕开 #69 修掉的时间戳问题。

改动

  • 遇到 editconflict / articleexists / pagedeleted 时,按标题和段落重新取最新版本,就地更新当前 WikiPage 实例(pageInfo 与 fetchedAt),编辑框内容保持不变。差异按钮、未保存检测和下一次提交拿到的都是最新版本
  • 新增事件 quick-edit/conflict(参数含最新 wikiPage、用户文本 text 和 error)
  • quick-diff 监听该事件,弹出“最新版本 → 用户文本”的差异窗口,它随编辑窗口一起关闭。页面已被删除或在新建段落时不弹出
  • 移除 dismissWarnings / recreate 路径:createonly 在提交时根据最新快照判断页面是否存在

Spec:docs/specs/2026-12-03-edit-conflict-timestamps.md(决策 2–4)

需要补充的翻译

新增文案:Edit Conflict、Failed to load the latest version of the page.、The latest version has been loaded. Review the differences; submitting again will save your text over the latest version.;不再使用:You can try to submit again to dismiss the warnings.

验证

  • typecheck:本次改动没有新增错误(preferences-ui 里原有的 4 条与本次无关)
  • 在本地萌百开发 wiki(MW 1.43,localhost:8000)上做了端到端测试:用一个管理员账号在浏览器里跑 IPE dev 构建,另一个账号通过 API 制造并发编辑(两次编辑改动同一行,MediaWiki 无法自动合并)
场景 master 本 PR
整页编辑冲突 两次提交都报“编辑冲突”,提示可以再次提交,但永远提交不上 弹出冲突提示和“最新版本 → 我的文本”差异,编辑框内容保留;再次提交成功,结果与差异所示一致
段落编辑冲突 — 差异只包含该段;再次提交后其他段落不受影响
删除后不刷新、直接用快速编辑重建(#10) “在您取得页面时间戳以来,页面已被删除” 第一次提交即成功
编辑期间他人抢先创建了页面 — 提示 articleexists 并显示差异;再次提交成为普通编辑

@dragon-fish
dragon-fish added this pull request to stack #71 December 3, 2026 10:34
Base automatically changed from fix/edit-timestamps to master December 3, 2026 13:14
Resubmitting after editconflict sent the same basetimestamp and failed again.
On editconflict/articleexists/pagedeleted, reload the page in place and emit
quick-edit/conflict; quick-diff shows latest vs the user's text. The next
submit is based on the latest version, so the recreate workaround is gone.
@dragon-fish
dragon-fish force-pushed the fix/quick-edit-conflict branch from b24c3b5 to 02f0402 Compare December 3, 2026 13:14
@dragon-fish
dragon-fish merged commit 0ebd2d3 into master Dec 3, 2026
1 check passed
@dragon-fish
dragon-fish deleted the fix/quick-edit-conflict branch December 3, 2026 13:27
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