Skip to content

Commit b05c977

Browse files
committed
review fixes
1 parent 26d4e83 commit b05c977

3 files changed

Lines changed: 8 additions & 37 deletions

File tree

apps/twig/src/renderer/api/posthogClient.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff 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
*/

apps/twig/src/renderer/features/auth/stores/authStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

apps/twig/src/renderer/features/projects/hooks/useProjects.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)