Skip to content

[windows] cold start first paint 生命周期未收敛,导致闪烁与错位 #143

@Cooper-X-Oak

Description

@Cooper-X-Oak

现象 / Symptom

Windows 冷启动前几秒会出现 UI flash、layout drift、ready 前展示错位。它和 issue #98 有关系,但不是同一层问题:#98 更关注 visible/ready contract,这一条更关注 first stable paint lifecycle

证据 / Evidence

  • openless-all/app/src-tauri/tauri.conf.json:17-30
    • main 创建后本应 hidden,说明项目原本就承认“创建态不等于可展示态”
  • openless-all/app/src/App.tsx:28-52
    • frontend mount 后会主动 show() 当前窗口
  • openless-all/app/src/App.tsx:23-27,54-61
    • Windows 路径直接跳过 checking gate,正式壳层很早开始渲染
  • openless-all/app/src/components/FloatingShell.tsx
    • 首帧直接进入正式 shell、正式 layout 与正式动画路径
  • 2026-05-02-platform-lifecycle-audit.md
    • 审计已将该问题归类为 first stable paint lifecycle 偏差

从时序上看,Windows 主窗口可能经历:

  1. Tauri window created
  2. React shell mounted
  3. requestAnimationFrame show
  4. runtime / layout / chrome / data 继续稳定

用户看到的“前几秒闪烁、错位、半成品感”正是这个 first stable paint 边界没有被收住的表现。

5 Whys / 根因分析

  1. 为什么冷启动会闪烁或错位?
    • 因为窗口在 first stable paint 之前已经暴露给用户。
  2. 为什么 first stable paint 没有成为明确边界?
    • 因为当前启动逻辑没有一个独立的“可展示态”判断,show 与正式 shell 渲染过早耦合。
  3. 为什么 Windows 更容易出现?
    • 因为它更早进入正式 UI 路径,同时自绘 frameless shell 对首帧稳定性更敏感。
  4. 为什么这偏离了 macOS 的原始设计意图?
    • macOS 的原始交互预期更接近“用户看到的是已成型界面”;Windows 当前展示的是一个仍在装配中的窗口生命周期中间态。
  5. 为什么之前没被门禁覆盖?
    • 现有验证没有对 cold-start first stable paint 做视觉或时序 smoke,只验证 build/check 或更靠后的功能可用性。

平台边界 / Platform Scope

  • 直接症状范围:当前主要是 Windows 冷启动视觉问题。
  • 问题层面:window show timing、first stable paint lifecycle、frameless shell startup sequencing。
  • 全平台风险判断:原则上任何平台都可能遇到,但 Windows 的自绘窗口与更激进的 ready 路径让问题更明显。

认领 / Ownership

  • owner intent:@Cooper-X-Oak
  • 当前对应 draft PR:#145

影响 / Impact

  • 直接降低 Windows 首次启动观感与可信度
  • 与 titlebar / frame / Mica / startup ready 问题叠加后,容易被用户感知为“应用启动质量差”
  • 让视觉回归定位变难:不容易区分是样式问题还是生命周期时序问题

建议接受标准 / Proposed Acceptance Criteria

  • Windows 冷启动时,主窗口只在 first stable paint 之后对用户可见,或明确先展示独立 startup shell
  • 不再暴露半成品壳层、明显 flash、layout drift 或 ready 前错位
  • 启动路径中 created / shown / first stable paint / ready 的边界被文档化并可 smoke 验证
  • 新的修复不与 issue #98 的 runtime ready contract 相互打架

TODO / 不确定项

  • 是否需要引入单独的 startup shell / placeholder shell,而不是直接展示正式 FloatingShell
  • 是否应为 Windows 新增 cold-start visual smoke 或录像式人工门禁

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions