fix: add error handling to meetings + verband dashboard pages
SSR pages crash with 500 when Supabase queries fail (expired session, network issues). Now catch errors and render with empty data instead of crashing the entire page.
This commit is contained in:
@@ -5,7 +5,7 @@ WORKDIR /app
|
||||
# --- Install + Build in one stage ---
|
||||
FROM base AS builder
|
||||
# CACHE_BUST: change this value to force a full rebuild (busts Docker layer cache)
|
||||
ARG CACHE_BUST=12
|
||||
ARG CACHE_BUST=13
|
||||
RUN echo "Cache bust: ${CACHE_BUST}"
|
||||
COPY . .
|
||||
RUN pnpm install --no-frozen-lockfile
|
||||
|
||||
@@ -23,11 +23,20 @@ export default async function MeetingsPage({ params }: PageProps) {
|
||||
|
||||
const api = createMeetingsApi(client);
|
||||
|
||||
const [stats, recentProtocols, overdueTasks] = await Promise.all([
|
||||
let stats = { totalProtocols: 0, thisYearProtocols: 0, openTasks: 0, overdueTasks: 0 };
|
||||
let recentProtocols: Awaited<ReturnType<typeof api.getRecentProtocols>> = [];
|
||||
let overdueTasks: Awaited<ReturnType<typeof api.getOverdueTasks>> = [];
|
||||
|
||||
try {
|
||||
[stats, recentProtocols, overdueTasks] = await Promise.all([
|
||||
api.getDashboardStats(acct.id),
|
||||
api.getRecentProtocols(acct.id),
|
||||
api.getOverdueTasks(acct.id),
|
||||
]);
|
||||
} catch (e) {
|
||||
// Supabase query failed — render with empty data instead of crashing
|
||||
console.error('Failed to load meetings dashboard:', e);
|
||||
}
|
||||
|
||||
return (
|
||||
<CmsPageShell account={account} title="Sitzungsprotokolle">
|
||||
|
||||
@@ -22,7 +22,14 @@ export default async function VerbandPage({ params }: PageProps) {
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createVerbandApi(client);
|
||||
const stats = await api.getDashboardStats(acct.id);
|
||||
|
||||
let stats = { totalClubs: 0, totalMembers: 0, totalRoles: 0, totalFeeTypes: 0 };
|
||||
|
||||
try {
|
||||
stats = await api.getDashboardStats(acct.id);
|
||||
} catch (e) {
|
||||
console.error('Failed to load verband dashboard:', e);
|
||||
}
|
||||
|
||||
return (
|
||||
<CmsPageShell account={account} title="Verbandsverwaltung">
|
||||
|
||||
Reference in New Issue
Block a user