chore(diag): 连线诊断补两条——边被改写、画板被同步整块替换
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m8s

用户实测:节点组里换了参考图(老图已断开),出图时却用了老图,且新图自动断开、连回老图。
可疑路径:3 秒同步轮询(syncOnceNow → applyLatestSync → loadWsInto)会用磁盘版本整块替换画板,
若替换前本地改动还没落盘,边会回退成旧状态;等出图后保存,又把回退状态写实。

- src/canvas-store.js:commit 时除 edge-drop 外,再记 edge-rewire(同 id 边端点被改写、数量不变)
- src/runtime-workbench-logic.js:applyLatestSync 替换画板前对比边集合,有增删就写
  board-sync-apply ws=… edges A→B gone=N added=M 到 _boot.log

两条都只在命中时写一行,平时无输出。
This commit is contained in:
qiqi committed 2026-11-27 23:16:03 +08:00
1 parent 375a3b2c0d
commit 72b568451e
3 files changed
+23 -1

No files matched your search

+13
View File
@@ -983,6 +983,19 @@
try { if (CrashLog && CrashLog.record) CrashLog.record('sync-conflict', { scope: 'applyLatest', message: '活动画布本地修改与同步冲突,保留本地', version: APP_VERSION }) } catch (e) { /* ignore */ }
return true
}
// v3.26.109 诊断:同步轮询会用磁盘版本整块替换画板;边若因此变化,留证据(用户实测「换参考图后出图又用了老图」)
try {
const before = (refs.edges || [])
const after = (curWs.edges || [])
const kept = new Set(after.map((e) => e && e.id))
const gone = before.filter((e) => e && !kept.has(e.id)).length
const added = after.filter((e) => e && !before.some((x) => x && x.id === e.id)).length
if (gone || added) {
const line = 'board-sync-apply ws=' + curWs.id + ' edges ' + before.length + '→' + after.length + ' gone=' + gone + ' added=' + added
const st = (typeof window !== 'undefined') ? window.IWBStorageFile : null
if (st && typeof st.logLine === 'function') st.logLine(line)
}
} catch (e) { /* 诊断失败不影响同步 */ }
loadWsInto(curWs, true) // 同步刷新不重置视口(避免画布漂移)
hydrateAndReload(curWs.id, syncedList) // 只按需 hydrate 当前画板
return true