Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop-app): skip empty leading-actions portal while minting (R1-L1)

Diego Zacariase975f36b38a7
diff --git a/desktop-app/ui/src/pages/SandboxUiPage.tsx b/desktop-app/ui/src/pages/SandboxUiPage.tsx
index 88a4e457a..6e73ea498 100644
--- a/desktop-app/ui/src/pages/SandboxUiPage.tsx
+++ b/desktop-app/ui/src/pages/SandboxUiPage.tsx
@@ -618,6 +618,14 @@ export function SandboxUiPage({
if (launch.kind === 'mounted' || launch.kind === 'minting') {
const showRefreshBanner =
refreshError && launch.kind === 'mounted' && refreshError.appRef === launch.appRef
+ // Every leading control below is gated: the refresh/copy pair only exists
+ // while 'mounted', and the conversation/drawer control needs an origin. In
+ // the 'minting' state without an origin all of them are absent, so portaling
+ // the wrapper unconditionally would inject an empty <div> into the shared
+ // title bar. Only portal when at least one control will render.
+ const hasLeadingActions =
+ launch.kind === 'mounted' ||
+ Boolean(conversationOrigin && (onToggleChatDrawer || onBackToConversation))
return (
<section className="page" data-testid="sandbox-ui-mounted">
{/* App actions live in the native title bar's leading slot (icon-only,
@@ -626,6 +634,7 @@ export function SandboxUiPage({
mirroring how the header search/bell portal works. "Back to apps" is
intentionally gone — the sidebar owns the return to the app picker. */}
{titlebarLeadingContainer &&
+ hasLeadingActions &&
createPortal(
<div className="window-titlebar__leading-actions">
{conversationOrigin && (onToggleChatDrawer || onBackToConversation) ? (
diff --git a/desktop-app/ui/src/pages/__tests__/SandboxUiPage.test.tsx b/desktop-app/ui/src/pages/__tests__/SandboxUiPage.test.tsx
index 7b8500351..ba301b9e1 100644
--- a/desktop-app/ui/src/pages/__tests__/SandboxUiPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/SandboxUiPage.test.tsx
@@ -195,6 +195,37 @@ describe('SandboxUiPage', () => {
expect(screen.getByRole('button', { name: 'Refresh app content' })).toBeTruthy()
})
+ it('does not portal an empty leading-actions container while minting without a conversation origin', async () => {
+ sandboxUi.listApps.mockResolvedValueOnce({
+ apps: [
+ {
+ appRef: 'sandbox-recipes/sales-crm',
+ title: "Andy's Sales CRM",
+ defaultPath: '/',
+ ready: true,
+ phase: 'active',
+ updatedAt: null,
+ },
+ ],
+ })
+ // Hold the open in-flight so the page stays in 'minting' (never reaches
+ // 'mounted'). With no conversationOrigin and no drawer/back handlers, every
+ // leading control is absent — the wrapper must not be portaled at all,
+ // otherwise an empty <div> is injected into the shared title bar.
+ sandboxUi.open.mockReturnValueOnce(new Promise<void>(() => {}))
+
+ render(<SandboxUiPage />)
+ fireEvent.click(await screen.findByRole('button', { name: "Open Andy's Sales CRM" }))
+
+ // The mounted/minting section renders (shared testid) and the open request
+ // is in-flight, so we are firmly in 'minting'.
+ expect(await screen.findByTestId('sandbox-ui-mounted')).toBeTruthy()
+ await waitFor(() => expect(sandboxUi.open).toHaveBeenCalled())
+
+ // The leading slot (portaled into the container) must stay empty.
+ expect(document.body.querySelector('.window-titlebar__leading-actions')).toBeNull()
+ })
+
it('exposes a chat-drawer toggle in the mounted header that reflects and drives drawer state', async () => {
sandboxUi.listApps.mockResolvedValueOnce({
apps: [