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 <noreply@anthropic.com>
This commit is contained in:
parent
c97add7376
commit
cb5f9ac0eb
2 changed files with 8 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
|||
allowBuilds:
|
||||
esbuild: set this to true or false
|
||||
esbuild: true
|
||||
sharp: true
|
||||
ignoredBuiltDependencies:
|
||||
- sharp
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue