File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -580,38 +580,6 @@ export class PostHogAPIClient {
580580 return await response . json ( ) ;
581581 }
582582
583- /**
584- * Get details for multiple projects by their IDs.
585- * Returns project info including organization details.
586- */
587- async getProjectDetails ( projectIds : number [ ] ) : Promise <
588- Array < {
589- id : number ;
590- name : string ;
591- organization : { id : string ; name : string } ;
592- } >
593- > {
594- const results = await Promise . all (
595- projectIds . map ( async ( projectId ) => {
596- try {
597- const project = await this . getProject ( projectId ) ;
598- return {
599- id : project . id ,
600- name : project . name ?? `Project ${ project . id } ` ,
601- organization : {
602- id : project . organization ?. toString ( ) ?? "" ,
603- name : project . organization ?. toString ( ) ?? "Unknown Organization" ,
604- } ,
605- } ;
606- } catch ( error ) {
607- log . warn ( `Failed to fetch project ${ projectId } :` , error ) ;
608- return null ;
609- }
610- } ) ,
611- ) ;
612- return results . filter ( ( r ) : r is NonNullable < typeof r > => r !== null ) ;
613- }
614-
615583 /**
616584 * Get all organizations the user belongs to.
617585 */
Original file line number Diff line number Diff line change @@ -687,7 +687,7 @@ export const useAuthStore = create<AuthState>()(
687687 const key = Array . isArray ( query . queryKey )
688688 ? query . queryKey [ 0 ]
689689 : query . queryKey ;
690- return key !== "projects" && key !== " currentUser";
690+ return key !== "currentUser" ;
691691 } ,
692692 } ) ;
693693
Original file line number Diff line number Diff line change @@ -51,10 +51,13 @@ export function useProjects() {
5151 const projects = useMemo ( ( ) => {
5252 if ( ! currentUser ?. organization ) return [ ] ;
5353
54- const teams = ( currentUser . organization . teams ?? [ ] ) as Array < {
55- id : number ;
56- name ?: string ;
57- } > ;
54+ const rawTeams = Array . isArray ( currentUser . organization . teams )
55+ ? currentUser . organization . teams
56+ : [ ] ;
57+ const teams = rawTeams . filter (
58+ ( t ) : t is { id : number ; name ?: string } =>
59+ t != null && typeof t === "object" && typeof t . id === "number" ,
60+ ) ;
5861 const orgName = currentUser . organization . name ?? "Unknown Organization" ;
5962 const orgId = currentUser . organization . id ?? "" ;
6063
You can’t perform that action at this time.
0 commit comments