feat: multi-team support with team-scoped resources and setup flow#18
feat: multi-team support with team-scoped resources and setup flow#18
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| } | ||
| }), | ||
| ); | ||
| const validProjects = projectsWithTeam.filter((p) => p !== null); |
There was a problem hiding this comment.
Blocking N+1 queries cause slow project list loading
High Severity
The getProjects function now uses await Promise.all() to fetch each project individually via getProject(), blocking until all N requests complete. Previously, prefetchQuery initiated background fetches without blocking the list return. This N+1 query pattern causes the project list to load significantly slower as the number of projects increases.
| if (team === "NO_TEAM_SELECTED") return <Redirect href="/setup/team" />; | ||
| if (setupComplete) return <Redirect href="/main" />; | ||
| else return <Redirect href="/setup" />; | ||
| return <Redirect href="/setup" />; |
There was a problem hiding this comment.
Fresh users incorrectly redirected to team selection
High Severity
The routing logic checks for team === "NO_TEAM_SELECTED" before checking setupComplete. For fresh users who haven't configured the server yet, both setupComplete is false and team is "NO_TEAM_SELECTED". This causes them to be redirected to /setup/team instead of /setup, where useTeams() attempts to fetch from an unconfigured server, resulting in a "Server address not found" error. The setupComplete check needs to come before the team check.


Add team selection and filter all Coolify resources by the selected team.
Team selection
/setup/team; users must pick a team before entering the app.TEAM_STORAGE_KEY).Team-scoped data
filterResourceByTeam/filterResourcesByTeaminlib/utils.ts.nullwhen the resource is not in the selected team.Other
lib/storage.ts:getCurrentTeam()helper./setup/teamwhen no team is selected.Note
Medium Risk
Core data-fetching hooks now filter and may return
null/empty lists based on selected team, which can surface newnullhandling needs across screens. Setup/navigation flow changes could block entry if team selection or storage state misbehaves.Overview
Adds multi-team support by introducing a persisted current team (
TEAM_STORAGE_KEY) inuseSetup, gating app entry until a team is chosen, and adding a new/setup/teamstep plus a Team selector in Settings.Scopes most resource fetchers (applications, databases, services, servers, projects, generic resources, private keys) to the selected team via new
filterResourceByTeam/filterResourcesByTeamhelpers; single-resource queries anduseResourcenow type asT | nullwhen the resource is outside the current team. Also tightens optimistic-update utilities (typedonOptimisticUpdateError, safer context handling, and consistentonOptimisticUpdateSettledusage) and adjusts project list fetching to hydrate team-aware project details before returning results.Written by Cursor Bugbot for commit 11325cc. This will update automatically on new commits. Configure here.