发布

  • [OPIK-6150] [FE] fix: preserve deep-link URL on workspace version mismatch (#6459)

    frostbyte_neo 发布于 2026-04-23 13:46:51 +00:00

    OPIK-6150 made workspace version verification non-blocking. For v1 deep
    links (e.g. /opik//experiments//compare) that land on a browser
    where the optimistic cache guess is v2, the mounted V2App renders the
    route subtree while /versions is in flight. That subtree contains
    V1CompatRedirect-style components whose useEffect calls
    navigate({ replace: true }) to a v2-specific path before the resolver
    sees the mismatch. By the time the resolver reloaded the page, the URL
    had already been rewritten to something the correct App's router
    cannot make sense of, dropping the user's original path.

    Capture window.location.href in the Resolver's render body (before any
    child effect can fire) and, on mismatch, window.location.replace() that
    captured URL instead of reloading the current one. The capture is
    keyed by workspace so a workspace switch doesn't leak a stale URL, and
    is cleared on successful verification so a later mismatch re-captures
    fresh rather than reloading to an outdated URL.

    Adds unit tests covering: immediate render, no reload on match, reload
    to captured URL when a child effect has mutated window.location,
    successful-verification clears the capture, per-workspace isolation,
    MAX_RELOADS cap, and counter clearance on match.

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

    下载附件