Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(agent): pin root layout direction (#18013)

Innei922f3e38bea0
diff --git a/src/routes/(main)/agent/_layout/index.test.tsx b/src/routes/(main)/agent/_layout/index.test.tsx
index 7b42c4a0dcc..cd63c90f674 100644
--- a/src/routes/(main)/agent/_layout/index.test.tsx
+++ b/src/routes/(main)/agent/_layout/index.test.tsx
@@ -8,8 +8,18 @@ import { describe, expect, it, vi } from 'vitest';
import Layout from './index';
vi.mock('@lobehub/ui', () => ({
- Flexbox: ({ children, ...props }: { children?: ReactNode; [key: string]: unknown }) => (
- <div {...props}>{children}</div>
+ Flexbox: ({
+ children,
+ direction,
+ ...props
+ }: {
+ children?: ReactNode;
+ direction?: 'horizontal' | 'vertical';
+ [key: string]: unknown;
+ }) => (
+ <div {...props} style={{ flexDirection: direction === 'vertical' ? 'column' : direction }}>
+ {children}
+ </div>
),
ShikiLobeTheme: {},
}));
@@ -43,6 +53,14 @@ describe('Agent layout', () => {
expect(screen.getByTestId('agent-layout-outlet')).toBeInTheDocument();
});
+ it('keeps routed content in a vertical layout', () => {
+ render(<Layout />);
+
+ expect(screen.getByTestId('agent-layout-outlet').parentElement).toHaveStyle({
+ flexDirection: 'column',
+ });
+ });
+
it('mounts AgentIdSync in layout', () => {
render(<Layout />);
diff --git a/src/routes/(main)/agent/_layout/index.tsx b/src/routes/(main)/agent/_layout/index.tsx
index d3627c15ff5..de65379a386 100644
--- a/src/routes/(main)/agent/_layout/index.tsx
+++ b/src/routes/(main)/agent/_layout/index.tsx
@@ -19,7 +19,7 @@ const Layout: FC = () => {
return (
<>
<AgentSidebar />
- <Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
+ <Flexbox className={styles.mainContainer} direction="vertical" flex={1} height={'100%'}>
{/* Keep the sidebar interactive when the routed agent is gone (deleted
or made private) — only the content area collapses to the 404 card. */}
<AgentNotFoundGuard>