From cb5f9ac0ebe743fd4c418dde1e7d38d732083651 Mon Sep 17 00:00:00 2001 From: Mannu Date: Mon, 11 May 2026 00:12:00 +0530 Subject: [PATCH] Fix FamilyProvider error handling - Add API error handling when fetching children - Set loading to false on API errors to prevent infinite loading state - Fix pnpm-workspace.yaml for build approval Co-Authored-By: Claude Opus 4.7 --- pnpm-workspace.yaml | 2 +- src/app/FamilyProvider.tsx | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index f86e175..bd16d45 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,5 +1,5 @@ allowBuilds: - esbuild: set this to true or false + esbuild: true sharp: true ignoredBuiltDependencies: - sharp diff --git a/src/app/FamilyProvider.tsx b/src/app/FamilyProvider.tsx index 9f33d54..bf56eb6 100644 --- a/src/app/FamilyProvider.tsx +++ b/src/app/FamilyProvider.tsx @@ -70,6 +70,13 @@ export function FamilyProvider({ children: providerChildren }: { children: React const res = await fetch(`/api/children?familyId=${familyId}`); const data = await res.json(); + // Handle API error + if (!res.ok || data.error) { + console.error("Failed to fetch children:", data.error); + setLoading(false); + return; + } + if (data.children?.length > 0) { const childList = data.children.map((c: any) => ({ id: c.id,