• 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
名称
最后提交
最后更新
..
ActionHeader.tsx 正在载入提交数据...
AnnotatorOnlyForPro.tsx 正在载入提交数据...
AnnotatorToolbar.tsx 正在载入提交数据...
CodeView.tsx 正在载入提交数据...
ConfigurePanel.tsx 正在载入提交数据...
Console.tsx 正在载入提交数据...
ConsoleEntry.tsx 正在载入提交数据...
ConsoleFilters.tsx 正在载入提交数据...
DraggableTextInput.tsx 正在载入提交数据...
FileEditor.tsx 正在载入提交数据...
FileTree.tsx 正在载入提交数据...
NeonConfigure.tsx 正在载入提交数据...
PlanPanel.tsx 正在载入提交数据...
PreviewIframe.tsx 正在载入提交数据...
PreviewPanel.tsx 正在载入提交数据...
Problems.tsx 正在载入提交数据...
PublishPanel.tsx 正在载入提交数据...
SecurityPanel.tsx 正在载入提交数据...
StylePopover.tsx 正在载入提交数据...
ToolbarColorPicker.tsx 正在载入提交数据...
VisualEditingChangesDialog.tsx 正在载入提交数据...
VisualEditingToolbar.tsx 正在载入提交数据...