@@ -23,6 +23,7 @@ import { BrowserSettingsReadError } from "../../browser/openFileInPreview";
2323import { addBrowserSurface } from "../preview/addBrowserSurface" ;
2424import { focusActivePanelTerminal , focusTerminal } from "../../lib/terminalFocus" ;
2525import { subscribePreviewAction } from "../preview/previewActionBus" ;
26+ import { floatDeviceSurface } from "../preview/agentOpenedPreviews" ;
2627import { browserMiniPlayerSource , usePreviewMiniPlayerStore } from "../../previewMiniPlayerStore" ;
2728import type { threadPullRequestPanelTarget } from "../pullRequest/pullRequestDetail.logic" ;
2829import type { useDeviceState } from "../../state/device" ;
@@ -37,6 +38,7 @@ interface RightPanelActionsInput {
3738 readonly activeRightPanelSurface : RightPanelSurface | null ;
3839 readonly activePreviewState : ThreadPreviewState ;
3940 readonly deviceState : ReturnType < typeof useDeviceState > [ "state" ] ;
41+ readonly deviceStateLoaded : boolean ;
4042 readonly pullRequestPanelTarget : ReturnType < typeof threadPullRequestPanelTarget > | null ;
4143 readonly threadPanelPresentation : ThreadPanelPresentation ;
4244 readonly isServerThread : boolean ;
@@ -69,6 +71,7 @@ export function useRightPanelActions(input: RightPanelActionsInput) {
6971 activeRightPanelSurface,
7072 activePreviewState,
7173 deviceState,
74+ deviceStateLoaded,
7275 pullRequestPanelTarget,
7376 threadPanelPresentation,
7477 isServerThread,
@@ -164,9 +167,11 @@ export function useRightPanelActions(input: RightPanelActionsInput) {
164167 . getState ( )
165168 . open ( activeThreadRef , browserMiniPlayerSource ( activeRightPanelSurface . resourceId ) ) ;
166169 } else if ( activeRightPanelSurface ?. kind === "device" && activeRightPanelSurface . target ) {
167- usePreviewMiniPlayerStore
168- . getState ( )
169- . open ( activeThreadRef , { kind : "device" , ...activeRightPanelSurface . target } ) ;
170+ floatDeviceSurface (
171+ activeThreadRef ,
172+ { kind : "device" , ...activeRightPanelSurface . target } ,
173+ deviceStateLoaded ? deviceState : null ,
174+ ) ;
170175 }
171176 useRightPanelStore . getState ( ) . setMaximized ( activeThreadRef , false ) ;
172177 useRightPanelStore . getState ( ) . close ( activeThreadRef ) ;
0 commit comments