Skip to content

fix: 修复 preview sync-scene 的中间 reset 状态暴露#1001

Merged
MakinoharaShoko merged 2 commits into
OpenWebGAL:devfrom
A-kirami:fix/preview-sync-scene-transaction
Jul 4, 2026
Merged

fix: 修复 preview sync-scene 的中间 reset 状态暴露#1001
MakinoharaShoko merged 2 commits into
OpenWebGAL:devfrom
A-kirami:fix/preview-sync-scene-transaction

Conversation

@A-kirami

@A-kirami A-kirami commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

概要

修复编辑器预览在快速切换 setTransform 语句时,画面短暂或持续显示默认 transform 的问题。

本次改动让 preview.command.sync-scene 在内部按 latest-only 事务执行:

  • sync-scene 期间不发布 reset 后的中间 stage.snapshot.updated
  • 只允许最新一次 sync-scene 在 settled 后提交并发布最终舞台状态
  • 过期的 fast preview 会在关键阶段退出,避免覆盖当前预览目标
  • resetStage 支持只重置计算状态,不立即提交 view state

背景

原链路中,sync-scene 会先执行 resetStage(true),再异步 runFastPreview() 快进到目标语句。由于 command response 是 accepted-only,会在真正 settled 前返回,快速切换时多个 reset / fast preview 容易重叠。

结果是 reset 后的默认舞台状态会被短暂暴露,并且在高频切换时被重复放大,表现为目标几乎常驻默认 transform。

主要改动

  • sync-scene 增加 revision 机制,保证只有最新任务能提交最终状态
  • 在 active sync-scene 期间压制 stage.snapshot.updated
  • stale sync-scene 在 fetch、scene write、commit 前都会停止继续推进
  • resetStage 增加 commitStageState 选项,供 preview sync 避免提交 reset 中间态
  • run-snippet / run-scene-content 会取消当前 active sync-scene

验证

  • 在两个 setTransform 语句之间快速切换
  • 确认 preview 不再闪现 reset/default transform
  • 确认 stage.snapshot.updated 不再发布 reset 产生的空中间态
  • 确认最终 settled 后仍会发布正确的舞台 snapshot

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MakinoharaShoko MakinoharaShoko merged commit 2d861df into OpenWebGAL:dev Jul 4, 2026
1 check passed
@A-kirami A-kirami deleted the fix/preview-sync-scene-transaction branch July 4, 2026 03:36
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.

2 participants