发布

  • [OPIK-6150] [FE] perf: don't block app render on workspace version verify

    frostbyte_neo 发布于 2026-04-23 07:47:51 +00:00

    WorkspaceVersionResolver wrapped its children in a Loader until the
    /workspaces/versions API call resolved. Measured cost: 600-2000ms per
    load, sitting on the LCP critical path right after the gate mounts
    V1App or V2App.

    The infrastructure for "render optimistically, reconcile async, reload
    on mismatch" already exists: the Gate's resolveSyncWorkspaceVersion()
    picks a version (override > opt-in > per-workspace cache > default v2)
    before React mounts, and the Resolver's useEffect reloads on mismatch
    (bounded by MAX_RELOADS). Drop the blocking Loader branch.

    Mismatch is rare — cache is correct for ~95% of returning users, and
    new signups get v2 which is the only version new workspaces use. On
    the rare mismatch path, the user sees the same 600-2000ms of
    potentially-wrong UI before the reload kicks in; today they stare at
    a Loader for the same window.

    Added a docstring on the component explaining the "render first, verify
    async" contract so future readers don't reintroduce the Loader as a
    defensive instinct.

    Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

    下载附件