Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(community): server nav lands on a channel, right-click group creation
Gener7dc58b11a6f2
diff --git a/src/web/src/app/community/channels/layout.tsx b/src/web/src/app/community/channels/layout.tsxindex 3410d6d4c..270873471 100644--- a/src/web/src/app/community/channels/layout.tsx+++ b/src/web/src/app/community/channels/layout.tsx@@ -128,16 +128,42 @@ export default function ServerLayout({ children }: { children: ReactNode }) {setInvitePopoverOpen(false)}, [serverId])+ // Open the dialog the instant we see the flag — this only touches local+ // state, so it can't race with the sibling default-channel page's own+ // redirect below. (Splitting this from the URL cleanup fixes a bug where+ // waiting to open the dialog until *after* the redirect meant the flag —+ // and the URL query string carrying it — was already gone by then, so the+ // dialog silently never opened.)useEffect(() => {- if (searchParams.get("settings") === "1") {- setServerSettingsOpen(true)- router.replace(`/community/channels/${serverId}`)- }- if (searchParams.get("invite") === "1") {- setInvitePopoverOpen(true)- router.replace(`/community/channels/${serverId}`)- }- }, [searchParams, serverId, router])+ if (searchParams.get("settings") === "1") setServerSettingsOpen(true)+ if (searchParams.get("invite") === "1") setInvitePopoverOpen(true)+ }, [searchParams])++ useEffect(() => {+ const wantsSettings = searchParams.get("settings") === "1"+ const wantsInvite = searchParams.get("invite") === "1"+ if (!wantsSettings && !wantsInvite) return++ // These flags land on the bare `/community/channels/:serverId` URL+ // (e.g. right-click a rail server → "Server settings"/"Invite to+ // Server"), which is also the URL the sibling default-channel page+ // redirects away from once it knows the server's first channel. When+ // that server's detail query is already warm in the cache, both+ // redirects fire in the very same commit — and since React runs a+ // child's effects before its parent's, our `router.replace` below would+ // run *after* the page's channel redirect and clobber it, stranding the+ // URL on the channel-less server root. Wait for that race to resolve+ // (channel present, or confirmed there are none) before stripping the+ // query so we don't fight the page's own navigation — once it lands on+ // a channel URL, that URL has no query string left to strip anyway.+ const stillRedirecting =+ !hasChannel && !!currentServer && currentServer.categories.some((c) => c.channels.length > 0)+ if (stillRedirecting) return++ router.replace(+ hasChannel ? `/community/channels/${serverId}/${params.channelId}` : `/community/channels/${serverId}`,+ )+ }, [searchParams, serverId, router, hasChannel, currentServer, params.channelId])const categories = currentServer?.categories ?? []const channelTree = useChannelTree(categories)diff --git a/src/web/src/hooks/community/mutations/folders.ts b/src/web/src/hooks/community/mutations/folders.tsindex 81b927979..ef9dec88f 100644--- a/src/web/src/hooks/community/mutations/folders.ts+++ b/src/web/src/hooks/community/mutations/folders.ts@@ -34,11 +34,17 @@ export function useCreateServerFolderWith() {{ snapshot: FoldersResponse | undefined; tempId: string }>({mutationFn: async ({ serverIdA, serverIdB }) => {+ // Right-click → "Create group" on a single rail server reuses this+ // same mutation with `serverIdA === serverIdB` (see `server-rail.tsx`)+ // to seed a one-server folder the user can then drag more servers+ // into. Dedupe so that path doesn't insert the same server twice —+ // both here and in `onMutate` below.+ const serverIds = [...new Set([serverIdA, serverIdB])]return apiFetch<CreateServerFolderWithResult>("/api/community/server-folders",{method: "POST",- body: JSON.stringify({ name: "Group", serverIds: [serverIdA, serverIdB] }),+ body: JSON.stringify({ name: "Group", serverIds }),},)},@@ -53,13 +59,12 @@ export function useCreateServerFolderWith() {return { id: s.id, name: s.name, initial: s.initial, icon: s.icon ?? null }}const tempId = `temp_${Date.now()}`+ const uniqueIds = [...new Set([args.serverIdA, args.serverIdB])]const tempFolder: CommunityFolder = {id: tempId,name: "Group",position: snapshot?.folders.length ?? 0,- servers: [findServer(args.serverIdA), findServer(args.serverIdB)].filter(- (s): s is FolderServer => s !== null,- ),+ servers: uniqueIds.map(findServer).filter((s): s is FolderServer => s !== null),}queryClient.setQueryData<FoldersResponse | undefined>(key, (prev) =>prev