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: prevent full page reload when switching topics during agent execution (#13309)

Arvin Xu0724d8ca606c
diff --git a/src/features/NavPanel/components/NavItem.tsx b/src/features/NavPanel/components/NavItem.tsx
index 878e8e2dbb5..0339174e6ab 100644
--- a/src/features/NavPanel/components/NavItem.tsx
+++ b/src/features/NavPanel/components/NavItem.tsx
@@ -102,12 +102,12 @@ const NavItem = memo<NavItemProps>(
paddingInline={4}
variant={variant}
onClick={(e) => {
- if (disabled || loading) return;
- // Prevent default link behavior for normal clicks (let onClick handle it)
- // But allow cmd+click to open in new tab
+ // Always prevent default <a> navigation for normal clicks to avoid full page reload.
+ // This must run before any early return to ensure SPA navigation is never bypassed.
if (href && !isModifierClick(e)) {
e.preventDefault();
}
+ if (disabled || loading) return;
onClick?.(e);
}}
{...linkProps}