diff --git a/apps/web/app/components/sidebar.tsx b/apps/web/app/components/sidebar.tsx index 094683da12f..f4575c955b4 100644 --- a/apps/web/app/components/sidebar.tsx +++ b/apps/web/app/components/sidebar.tsx @@ -437,6 +437,7 @@ export function Sidebar({ setShowCreateWorkspace(true)} + activeProfileHint={String(sidebarRefreshKey)} /> diff --git a/apps/web/app/components/workspace/profile-switcher.tsx b/apps/web/app/components/workspace/profile-switcher.tsx index 035ceab949b..c7e8f5fb7f4 100644 --- a/apps/web/app/components/workspace/profile-switcher.tsx +++ b/apps/web/app/components/workspace/profile-switcher.tsx @@ -13,9 +13,11 @@ export type ProfileInfo = { type ProfileSwitcherProps = { onProfileSwitch?: () => void; onCreateWorkspace?: () => void; + /** Parent-tracked active profile — triggers a re-fetch when it changes (e.g. after workspace creation). */ + activeProfileHint?: string | null; }; -export function ProfileSwitcher({ onProfileSwitch, onCreateWorkspace }: ProfileSwitcherProps) { +export function ProfileSwitcher({ onProfileSwitch, onCreateWorkspace, activeProfileHint }: ProfileSwitcherProps) { const [profiles, setProfiles] = useState([]); const [activeProfile, setActiveProfile] = useState("default"); const [isOpen, setIsOpen] = useState(false); @@ -35,7 +37,7 @@ export function ProfileSwitcher({ onProfileSwitch, onCreateWorkspace }: ProfileS useEffect(() => { void fetchProfiles(); - }, [fetchProfiles]); + }, [fetchProfiles, activeProfileHint]); // Close dropdown on outside click useEffect(() => { diff --git a/apps/web/app/components/workspace/workspace-sidebar.tsx b/apps/web/app/components/workspace/workspace-sidebar.tsx index c045cf0297e..acd8b00242f 100644 --- a/apps/web/app/components/workspace/workspace-sidebar.tsx +++ b/apps/web/app/components/workspace/workspace-sidebar.tsx @@ -520,6 +520,7 @@ export function WorkspaceSidebar({ setShowCreateWorkspace(true)} + activeProfileHint={activeProfile} /> )}