diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 971fbbb6eb33f..0a2258419b2b3 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -3001,7 +3001,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 62606cdb2cebe..b6c889508a6a8 100644 --- a/apps/web/src/components/RightPanelTabs.tsx +++ b/apps/web/src/components/RightPanelTabs.tsx @@ -36,7 +36,9 @@ import { } from "~/fork/dashboard/dashboardSurface"; import { AllMenuItemsHidden, + type SurfaceActionDrag, useArrangedSurfaceActions, + useSurfaceActionDrag, } from "~/fork/rightPanelMenu/rightPanelMenu"; import { displayTitle, @@ -169,7 +171,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; @@ -179,7 +185,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; @@ -339,10 +345,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; @@ -367,8 +375,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; @@ -560,6 +569,7 @@ function RightPanelEmptyState(props: { } >