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.

✨ feat(onboarding): skip redirect when landing on agent/inbox with message param (#15256)

LiJianf0eded29418a
diff --git a/src/layout/GlobalProvider/useUserStateRedirect.ts b/src/layout/GlobalProvider/useUserStateRedirect.ts
index 5164d54b019..c08dda9d0bc 100644
--- a/src/layout/GlobalProvider/useUserStateRedirect.ts
+++ b/src/layout/GlobalProvider/useUserStateRedirect.ts
@@ -20,10 +20,16 @@ export const useDesktopUserStateRedirect = () => {
export const useWebUserStateRedirect = () =>
useCallback((state: UserInitializationState) => {
- const { pathname } = window.location;
+ const { pathname, search } = window.location;
if (!onboardingSelectors.needsOnboarding(state)) return;
+ // Skip onboarding when the user lands on any agent page with a message param
+ // (e.g. "Try in LobeHub" links from Skills Marketplace). The /agent/inbox slug
+ // may be rewritten to /agent/{resolvedId} by AgentIdSync before this callback
+ // fires, so matching only /agent/inbox would miss the resolved-slug case.
+ if (pathname.startsWith('/agent/') && new URLSearchParams(search).has('message')) return;
+
redirectIfNotOn(pathname, '/onboarding');
}, []);