fix: 修复 preview sync-scene 的中间 reset 状态暴露#1001
Conversation
Prevent sync-scene from exposing reset-stage intermediate state while fast preview is settling. The preview runtime now suppresses stage snapshots during sync-scene, only publishes the settled view state, and ignores stale sync-scene runs before they can commit over the latest preview target.
There was a problem hiding this comment.
Code Review
This pull request introduces a revision-based transaction mechanism to the preview synchronization runtime to prevent outdated sync scene operations from executing or committing state. It adds an isLatest check to executePreviewSyncSceneCommand and runFastPreview to abort operations early if a newer sync transaction has started. Additionally, resetStage is updated to support an optional commitStageState flag to control whether stage state changes are committed. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
概要
修复编辑器预览在快速切换
setTransform语句时,画面短暂或持续显示默认 transform 的问题。本次改动让
preview.command.sync-scene在内部按 latest-only 事务执行:sync-scene期间不发布 reset 后的中间stage.snapshot.updatedsync-scene在 settled 后提交并发布最终舞台状态resetStage支持只重置计算状态,不立即提交 view state背景
原链路中,
sync-scene会先执行resetStage(true),再异步runFastPreview()快进到目标语句。由于 command response 是 accepted-only,会在真正 settled 前返回,快速切换时多个 reset / fast preview 容易重叠。结果是 reset 后的默认舞台状态会被短暂暴露,并且在高频切换时被重复放大,表现为目标几乎常驻默认 transform。
主要改动
sync-scene增加 revision 机制,保证只有最新任务能提交最终状态sync-scene期间压制stage.snapshot.updatedsync-scene在 fetch、scene write、commit 前都会停止继续推进resetStage增加commitStageState选项,供 preview sync 避免提交 reset 中间态run-snippet/run-scene-content会取消当前 activesync-scene验证
setTransform语句之间快速切换stage.snapshot.updated不再发布 reset 产生的空中间态