Skip to content

Commit 211d4d0

Browse files
committed
review fixes
1 parent 9145329 commit 211d4d0

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ export class PostHogAPIClient {
132132
}
133133
}
134134

135-
setTeamId(teamId: number): void {
136-
this._teamId = teamId;
135+
setTeamId(teamId: number | null | undefined): void {
136+
this._teamId = teamId ?? null;
137137
}
138138

139139
private async getTeamId(): Promise<number> {

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ async function buildOrgProjectsMap(
195195

196196
const entries = await Promise.all(
197197
orgs.map(async (org) => {
198-
const projects = await client.listOrgProjects(org.id).catch(() => []);
198+
const projects = await client.listOrgProjects(org.id).catch((err) => {
199+
log.warn("Failed to fetch projects for org", { orgId: org.id, err });
200+
return [];
201+
});
199202
return [
200203
org.id,
201204
{
@@ -814,6 +817,14 @@ export const useAuthStore = create<AuthState>()(
814817
selectProject: (projectId: number) => {
815818
const state = get();
816819

820+
const allProjectIds = Object.values(state.orgProjectsMap).flatMap(
821+
(o) => o.projects.map((p) => p.id),
822+
);
823+
if (!allProjectIds.includes(projectId)) {
824+
log.error("Attempted to select invalid project", { projectId });
825+
throw new Error("Invalid project selection");
826+
}
827+
817828
const cloudRegion = state.cloudRegion;
818829
if (!cloudRegion) {
819830
throw new Error("No cloud region available");

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,5 @@ export function useProjects() {
6969
currentProject,
7070
currentProjectId,
7171
isLoading: false,
72-
error: null,
7372
};
7473
}

0 commit comments

Comments
 (0)