fix: add array guards to all frontend components consuming API responses
Prevents "M.forEach is not a function" crashes when API returns error objects or unexpected shapes instead of arrays. Guards all useQuery consumers with Array.isArray checks and safe defaults for object props. Files fixed: DeadlineList, AppointmentList, TenantSwitcher, DeadlineTrafficLights, UpcomingTimeline, CaseOverviewGrid, AISummaryCard, TeamSettings, and all page-level components (dashboard, cases, fristen, termine, ai/extract).
This commit is contained in:
@@ -9,7 +9,9 @@ interface Props {
|
||||
|
||||
function generateSummary(data: DashboardData): string {
|
||||
const parts: string[] = [];
|
||||
const { deadline_summary: ds, case_summary: cs, upcoming_deadlines: ud } = data;
|
||||
const ds = data.deadline_summary ?? { overdue_count: 0, due_this_week: 0, due_next_week: 0, ok_count: 0 };
|
||||
const cs = data.case_summary ?? { active_count: 0, new_this_month: 0, closed_count: 0 };
|
||||
const ud = Array.isArray(data.upcoming_deadlines) ? data.upcoming_deadlines : [];
|
||||
|
||||
// Deadline urgency
|
||||
if (ds.overdue_count > 0) {
|
||||
|
||||
Reference in New Issue
Block a user