From e8a725f3be0d735ef6eecfb026cbb2064f79bb0c Mon Sep 17 00:00:00 2001 From: Raghuram Banda Date: Thu, 21 May 2026 11:52:25 -0400 Subject: [PATCH] fix: auto-switch to My Agents tab after creation and fix intent dialog reopen After creating an agent, the user was left on the Explore tab where drafts are invisible. Now the Marketplace automatically switches to the My Agents tab so the user sees their new draft immediately. Also fixes the intent dialog reopening after image-deploy: the wizard's onClose (handleWizardBack) was triggering setIntentDialogOpen(true) even after onCreated had already closed the wizard. A ref now suppresses the reopen when an agent was just created. Part of Epic #3208 --- .../augment/src/components/AugmentPage/ChatView.tsx | 11 ++++++++++- .../src/components/Marketplace/MarketplacePage.tsx | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/workspaces/augment/plugins/augment/src/components/AugmentPage/ChatView.tsx b/workspaces/augment/plugins/augment/src/components/AugmentPage/ChatView.tsx index 09a537af4d..bdbfb1c45f 100644 --- a/workspaces/augment/plugins/augment/src/components/AugmentPage/ChatView.tsx +++ b/workspaces/augment/plugins/augment/src/components/AugmentPage/ChatView.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import { useState, useCallback, useEffect, type Ref } from 'react'; +import { useState, useCallback, useEffect, useRef, type Ref } from 'react'; import Box from '@mui/material/Box'; import LinearProgress from '@mui/material/LinearProgress'; import Alert from '@mui/material/Alert'; @@ -97,6 +97,8 @@ export function ChatView({ const [currentAgent, setCurrentAgent] = useState(); const [showMarketplace, setShowMarketplace] = useState(true); const [marketplaceRefreshKey, setMarketplaceRefreshKey] = useState(0); + const [switchToMyAgents, setSwitchToMyAgents] = useState(0); + const justCreatedRef = useRef(false); // Agent creation state (all dialogs live in the front door) const [intentDialogOpen, setIntentDialogOpen] = useState(false); @@ -201,6 +203,10 @@ export function ChatView({ const handleWizardBack = useCallback(() => { setWizardOpen(false); setWizardDeployMethod(undefined); + if (justCreatedRef.current) { + justCreatedRef.current = false; + return; + } setIntentDialogOpen(true); }, []); @@ -236,12 +242,14 @@ export function ChatView({ }, []); const handleAgentCreated = useCallback(() => { + justCreatedRef.current = true; setWizardOpen(false); setWizardDeployMethod(undefined); setCreateSuccess( 'Agent created successfully! It will appear in your agents list.', ); setMarketplaceRefreshKey(k => k + 1); + setSwitchToMyAgents(k => k + 1); }, []); // --- Tool Creation Flow --- @@ -322,6 +330,7 @@ export function ChatView({ onOpenCommandCenter={handleSwitchToAdmin} onOpenGuidedTour={handleOpenGuidedTour} refreshKey={marketplaceRefreshKey} + switchToMyAgentsKey={switchToMyAgents} /> )} diff --git a/workspaces/augment/plugins/augment/src/components/Marketplace/MarketplacePage.tsx b/workspaces/augment/plugins/augment/src/components/Marketplace/MarketplacePage.tsx index 9e0331e134..245c47b53f 100644 --- a/workspaces/augment/plugins/augment/src/components/Marketplace/MarketplacePage.tsx +++ b/workspaces/augment/plugins/augment/src/components/Marketplace/MarketplacePage.tsx @@ -50,6 +50,8 @@ interface MarketplacePageProps { onOpenCommandCenter?: () => void; onOpenGuidedTour?: () => void; refreshKey?: number; + /** When this key changes, automatically switch to the My Agents tab */ + switchToMyAgentsKey?: number; } /** @@ -66,6 +68,7 @@ export function MarketplacePage({ onOpenCommandCenter, onOpenGuidedTour, refreshKey, + switchToMyAgentsKey, }: MarketplacePageProps) { const theme = useTheme(); const isDark = theme.palette.mode === 'dark'; @@ -120,6 +123,12 @@ export function MarketplacePage({ }; }, [api, refreshKey]); + useEffect(() => { + if (switchToMyAgentsKey && switchToMyAgentsKey > 0) { + setActiveTab('my-agents'); + } + }, [switchToMyAgentsKey]); + const frameworks = useMemo(() => { const set = new Set(); agents.forEach(a => {