From 2b6a8d337fbf850aecdeb80be845f0011b6a54e8 Mon Sep 17 00:00:00 2001 From: SirKentut <81878031+SirKentut@users.noreply.github.com> Date: Mon, 22 Jun 2026 02:02:45 -0700 Subject: [PATCH] [pierre] fix: persist selection on new-agent composer across collapse --- frontend/src/app/pages/Dashboard/DashboardToolbar.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/pages/Dashboard/DashboardToolbar.tsx b/frontend/src/app/pages/Dashboard/DashboardToolbar.tsx index 46e2493c..bedf49b5 100644 --- a/frontend/src/app/pages/Dashboard/DashboardToolbar.tsx +++ b/frontend/src/app/pages/Dashboard/DashboardToolbar.tsx @@ -290,14 +290,17 @@ const DashboardToolbar = React.forwardRef( const autoSelectOnNew = useAppSelector((s) => s.settings.data.auto_select_mode_on_new_agent); const prevInputOpenRef = useRef(inputOpen); useEffect(() => { + // Collapsing the composer drops the selecting cursor but KEEPS the selected + // elements, so they persist across collapse/reopen like the draft text does. + // The selection is cleared on send via ChatInput's clearOwnerElements(ownerId). if (prevInputOpenRef.current && !inputOpen && elementSelection) { - elementSelection.clearOwnerElements(TOOLBAR_OWNER_ID); if (elementSelection.selectMode && elementSelection.activeOwnerId === TOOLBAR_OWNER_ID) { elementSelection.setSelectMode(false); } } + // Re-arm select mode on reopen without wiping any in-progress selection + // (mirrors the selector button, which only clears when switching owners). if (!prevInputOpenRef.current && inputOpen && autoSelectOnNew && elementSelection) { - elementSelection.clearOwnerElements(TOOLBAR_OWNER_ID); elementSelection.setActiveOwnerId(TOOLBAR_OWNER_ID); elementSelection.setExcludeSelectId(null); elementSelection.setSelectMode(true);