diff --git a/src/app/(app)/stock-orders/page.tsx b/src/app/(app)/stock-orders/page.tsx index 317c182..95eec73 100644 --- a/src/app/(app)/stock-orders/page.tsx +++ b/src/app/(app)/stock-orders/page.tsx @@ -55,22 +55,18 @@ export default async function StockOrdersPage({ const status = parseStatus(params.status); const page = parsePage(params.page); - let result: Awaited>; + let result: Awaited> | null = null; + let loadError: string | null = null; try { const pb = await getAdminPocketBase(); result = await listStockPurchases(pb, { status, page, perPage: 50 }); } catch (err) { - // Surface the failure inline rather than redirect to a global - // error boundary — operators need the URL context to retry. - return ( -
-

Stock Orders

-

- Failed to load stock orders:{" "} - {err instanceof Error ? err.message : "unknown error"} -

-
- ); + // Log full error server-side so operators have the diagnostic + // trail; show only a generic message to the user — internal + // detail (PB URLs, env-var names, filter syntax) is not safe + // to surface in the operator UI. + console.error("stock-orders list failed:", err); + loadError = "Failed to load stock orders. Please try again."; } return ( @@ -90,18 +86,27 @@ export default async function StockOrdersPage({ > Reorder from low stock - + + New stock order - + {loadError ? ( +
+ {loadError} +
+ ) : ( + + )} ); } \ No newline at end of file