From c8a015106dcffb914682d6ff7e5f0048873a7a41 Mon Sep 17 00:00:00 2001 From: Gagancreates Date: Mon, 8 Jun 2026 02:04:31 +0530 Subject: [PATCH] fix: keep overflow menu open when toggling items inside it Toggling an in-menu item (code mode, agent, search, perm) updated state that was in the collapse-reset deps, resetting collapseLevel to 0 and unmounting the '...' trigger mid-interaction. Drop the in-place toggles from the reset deps so the menu stays open on click. --- .../renderer/src/components/chat-input-with-mentions.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/x/apps/renderer/src/components/chat-input-with-mentions.tsx b/apps/x/apps/renderer/src/components/chat-input-with-mentions.tsx index dfdfa335..49957ea9 100644 --- a/apps/x/apps/renderer/src/components/chat-input-with-mentions.tsx +++ b/apps/x/apps/renderer/src/components/chat-input-with-mentions.tsx @@ -313,10 +313,14 @@ function ChatInputInner({ return () => ro.disconnect() }, []) - // …or when the set/labels of items changes (these all affect item widths). + // …or when the *set* of items changes (an item appears/disappears, or the model + // name width changes). Deliberately excludes the in-place toggles (searchEnabled, + // permissionMode, codeModeEnabled, codingAgent): those fire from the overflow menu + // for items already inside it, so resetting here would unmount the open menu. The + // no-dep effect below still re-collapses if any toggle happens to widen the row. useLayoutEffect(() => { setCollapseLevel(0) - }, [workDir, searchEnabled, searchAvailable, codeModeEnabled, codeModeFeatureEnabled, codingAgent, permissionMode, lockedModel, activeModelKey]) + }, [workDir, searchAvailable, codeModeFeatureEnabled, lockedModel, activeModelKey]) // After each render, if the left group still overflows, collapse one more step. // Runs before paint, so the intermediate (overflowing) state is never visible.