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: workspace url sync (#15728)

Rdmclin252eaf2702e45
diff --git a/src/features/Workspace/useWorkspaceUrlSync.ts b/src/features/Workspace/useWorkspaceUrlSync.ts
index 59c622ee539..a8bd5836b3d 100644
--- a/src/features/Workspace/useWorkspaceUrlSync.ts
+++ b/src/features/Workspace/useWorkspaceUrlSync.ts
@@ -45,6 +45,21 @@ const parseFirstSegment = (pathname: string): string | null => {
return match ? match[1] : null;
};
+/**
+ * Whether `pathname`'s first segment could be an (as-yet-unresolved) workspace
+ * slug — i.e. it's present and not one of the reserved root segments.
+ *
+ * Top-level rendering only needs to block on the workspace list (to avoid a
+ * false 404 / wrong-scope paint) when this is `true`. On personal / reserved
+ * routes (`/`, `/agent/...`, `/settings/...`) the list isn't required to render,
+ * so callers can show personal context immediately and let the list hydrate in
+ * the background.
+ */
+export const isWorkspaceSlugCandidatePath = (pathname: string): boolean => {
+ const first = parseFirstSegment(pathname);
+ return !!first && !RESERVED_FIRST_SEGMENTS.has(first);
+};
+
/**
* URL is the source of truth for workspace context.
*