Skip to content

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

TypeScript

refactor(desktop-app): use null sentinel for the unmeasured chat-drawer top

Diego Zacariascfc4d994b098
diff --git a/desktop-app/ui/src/App.tsx b/desktop-app/ui/src/App.tsx
index 1ef5fad63..b27d0b818 100644
--- a/desktop-app/ui/src/App.tsx
+++ b/desktop-app/ui/src/App.tsx
@@ -265,7 +265,7 @@ export function App() {
// Measured top of the embed slot, published as `--chat-drawer-top` so the fixed
// drawer follows the app content down when the sandbox-ui header wraps (narrow
// window). 0 means "not measured yet" -> the CSS fallback (64px) applies.
- const [chatDrawerEmbedTop, setChatDrawerEmbedTop] = React.useState(0)
+ const [chatDrawerEmbedTop, setChatDrawerEmbedTop] = React.useState<number | null>(null)
const [chatSwitcherFocusRequestId, setChatSwitcherFocusRequestId] = React.useState(0)
const [availableSandboxUiApps, setAvailableSandboxUiApps] = React.useState<ActiveSandboxUiApp[]>(
[]
@@ -2020,8 +2020,10 @@ export function App() {
? {
'--chat-drawer-width': `${chatDrawerResize.width}px`,
// Only publish the measured top once we have one;
- // when 0 (pre-measure/tests) the CSS fallback applies.
- ...(chatDrawerEmbedTop > 0
+ // when unmeasured (null, pre-measure/tests) the CSS
+ // fallback applies. Uses null — not 0 — so a legitimate
+ // rect.top of 0/negative still follows the embed.
+ ...(chatDrawerEmbedTop !== null
? { '--chat-drawer-top': `${chatDrawerEmbedTop}px` }
: {}),
}
diff --git a/desktop-app/ui/src/__tests__/chatDrawerHeaderStacking.test.tsx b/desktop-app/ui/src/__tests__/chatDrawerHeaderStacking.test.tsx
index 824bce39f..e52575fee 100644
--- a/desktop-app/ui/src/__tests__/chatDrawerHeaderStacking.test.tsx
+++ b/desktop-app/ui/src/__tests__/chatDrawerHeaderStacking.test.tsx
@@ -68,7 +68,7 @@ describe('chat drawer header stacking', () => {
// while the z-lift to the dropdown layer (593d7f5c) is preserved.
const rule = /\.content-panel--chat-drawer-open \.top-bar\s*\{([^}]*)\}/.exec(stylesCss)
expect(rule).not.toBeNull()
- const body = rule![1]
+ const body = rule![1] ?? ''
const right = /right:\s*([^;]+);/.exec(body)
expect(right).not.toBeNull()
expect(right![1]).toContain('--chat-drawer-width')