diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 6b0ffa7767869..0d434400f531e 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -2995,7 +2995,7 @@ export default function ChatView(props: ChatViewProps) { ) ? gt("Available once the thread's worktree is set up.") : null; - const openSideChatStable = useStableCallback(() => void sideChat.open()); + const openSideChatStable = useStableCallback(() => sideChat.open()); const openSurfaceInMainView = useOpenSurfaceInMainView(activeThreadRef); const sendSideChatStable = useStableCallback(sideChat.open); const { onConfirmRevertStable, onForkFromRunStable, onRevertTimelineTurnStable } = diff --git a/apps/web/src/components/RightPanelTabs.tsx b/apps/web/src/components/RightPanelTabs.tsx index 34963cd73af99..fa074b5680ece 100644 --- a/apps/web/src/components/RightPanelTabs.tsx +++ b/apps/web/src/components/RightPanelTabs.tsx @@ -35,7 +35,9 @@ import { } from "~/fork/dashboard/dashboardSurface"; import { AllMenuItemsHidden, + type SurfaceActionDrag, useArrangedSurfaceActions, + useSurfaceActionDrag, } from "~/fork/rightPanelMenu/rightPanelMenu"; import { displayTitle, @@ -168,7 +170,11 @@ export interface RightPanelTabsProps void; onCopyFilePath: (relativePath: string) => void; onDuplicateBrowser?: (surface: Entry) => void; - onAddBrowser: () => void; + /** + * Opens a browser tab. A returned promise lets a drop wait for the open, so a user action before + * it settles wins over the drop's place. + */ + onAddBrowser: () => void | Promise; /** Keep separate from the DOM click handler so a MouseEvent cannot become a profile id. */ onAddBrowserInProfile: (profileId: string) => void; onAddTerminal: () => void; @@ -178,7 +184,7 @@ export interface RightPanelTabsProps void; onAddDevice: () => void; /** Absent where side chats are not offered. */ - onAddSideChat?: (() => void) | undefined; + onAddSideChat?: (() => void | Promise) | undefined; /** Items that open the tabs of the thread's display mode and Dashboard switch, such as Replies. */ modeSurfaceActions?: ReadonlyArray | undefined; browserAvailable: boolean; @@ -338,10 +344,12 @@ function SurfaceMenuItem(props: { disabledReason?: string; shortcut: string; onClick: () => void; + drag: ReturnType; children: ReactNode; }) { const item = ( void; + onAddBrowser: () => void | Promise; onAddBrowserInProfile: (profileId: string) => void; browserProfiles: ReadonlyArray<{ readonly id: string; readonly name: string }>; onAddTerminal: () => void; @@ -366,8 +374,9 @@ function RightPanelEmptyState(props: { onAddPullRequests: () => void; onAddDevice: () => void; /** Absent where side chats are not offered. */ - onAddSideChat?: (() => void) | undefined; + onAddSideChat?: (() => void | Promise) | undefined; modeSurfaceActions?: ReadonlyArray | undefined; + actionDrag: SurfaceActionDrag; browserAvailable: boolean; terminalAvailable: boolean; diffAvailable: boolean; @@ -559,6 +568,7 @@ function RightPanelEmptyState(props: { } >