diff --git a/packages/template/src/lib/hexclave-app/apps/implementations/server-app-impl.ts b/packages/template/src/lib/hexclave-app/apps/implementations/server-app-impl.ts index e91d39fcc..b147f04a7 100644 --- a/packages/template/src/lib/hexclave-app/apps/implementations/server-app-impl.ts +++ b/packages/template/src/lib/hexclave-app/apps/implementations/server-app-impl.ts @@ -723,16 +723,20 @@ export class _HexclaveServerAppImplIncomplete t.id === teamId) ?? null; }, // IF_PLATFORM react-like useTeam(teamId: string) { - const team = useAsyncCache(app._serverTeamCache, [teamId], "user.useTeam()"); + const teams = this.useTeams(); return useMemo(() => { - return team == null ? null : app._serverTeamFromCrud(team); - }, [team]); + return teams.find((t) => t.id === teamId) ?? null; + }, [teams, teamId]); }, // END_PLATFORM async listTeams(options?: ServerListTeamsOptions): Promise { diff --git a/sdks/spec/src/types/users/server-user.spec.md b/sdks/spec/src/types/users/server-user.spec.md index 129465797..6a5bc7374 100644 --- a/sdks/spec/src/types/users/server-user.spec.md +++ b/sdks/spec/src/types/users/server-user.spec.md @@ -113,9 +113,7 @@ teamId: string Returns: ServerTeam | null -GET /api/v1/teams/{teamId} [server-only] - -Returns the team with the requested ID, or null if it does not exist. +Find in listTeams() by id. This is deliberately scoped to the user's own team memberships (unlike the app-level getTeam), so it returns null for teams the user is not a member of. Does not error.