• wwwillchen-bot's avatar
    Fix preview navigation black screen when selecting routes from dropdown (#2610) · fb73c208
    wwwillchen-bot 提交于
    ## Summary
    - Changed `navigateToRoute()` to use `postMessage` +
    `location.replace()` pattern instead of direct `location.href`
    assignment
    - This matches the approach used by back/forward navigation buttons and
    provides smooth navigation without the black screen flicker and sidebar
    state reset
    - Also added proper `currentIframeUrlRef` and `preservedUrls` updates
    for HMR remount consistency
    
    Fixes #2428
    
    ## Test plan
    - [x] Build succeeds
    - [x] Unit tests pass (784 tests)
    - [x] E2E tests pass for preview navigation (`npm run e2e -- --grep
    "preview navigation"`)
    - Manual testing: Open a multi-page app, use the route dropdown to
    navigate between routes - should no longer see black screen flicker or
    sidebar collapse
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2610"
    target="_blank">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Fixes #2428: removes black screen flicker and sidebar collapse when
    selecting routes from the preview dropdown. Navigation now uses
    postMessage + location.replace and keeps the iframe src stable across
    SPA navigation and HMR.
    
    - **Bug Fixes**
    - Use postMessage + location.replace to navigate; prevents flicker and
    preserves sidebar state.
    - Freeze iframe src with useMemo and same-origin check so SPA nav/HMR
    don’t reset it; added e2e test to verify src remains unchanged.
    - Sync navigation state: history, canGoBack/canGoForward,
    currentIframeUrlRef, and per-app preservedUrls (clears on root).
    
    <sup>Written for commit 1bdd7635ea432c564fe77fea57062df1a9d2f56d.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    ---------
    Co-authored-by: 's avatarWill Chen <willchen90@gmail.com>
    Co-authored-by: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
    fb73c208
名称
最后提交
最后更新
..
__tests__ 正在载入提交数据...
app 正在载入提交数据...
atoms 正在载入提交数据...
client_logic 正在载入提交数据...
components 正在载入提交数据...
constants 正在载入提交数据...
contexts 正在载入提交数据...
db 正在载入提交数据...
hooks 正在载入提交数据...
i18n 正在载入提交数据...
ipc 正在载入提交数据...
lib 正在载入提交数据...
main 正在载入提交数据...
neon_admin 正在载入提交数据...
pages 正在载入提交数据...
paths 正在载入提交数据...
pro 正在载入提交数据...
prompts 正在载入提交数据...
routes 正在载入提交数据...
shared 正在载入提交数据...
store 正在载入提交数据...
styles 正在载入提交数据...
supabase_admin 正在载入提交数据...
utils 正在载入提交数据...
backup_manager.ts 正在载入提交数据...
main.ts 正在载入提交数据...
preload.ts 正在载入提交数据...
renderer.tsx 正在载入提交数据...
router.ts 正在载入提交数据...