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:
m
2026-03-25 18:34:11 +01:00
parent e635efa71e
commit 50bfa3deb4
14 changed files with 42 additions and 33 deletions

View File

@@ -15,6 +15,7 @@ export function TenantSwitcher() {
api
.get<TenantWithRole[]>("/tenants")
.then((data) => {
if (!Array.isArray(data)) return;
setTenants(data);
const savedId = localStorage.getItem("kanzlai_tenant_id");
const match = data.find((t) => t.id === savedId) || data[0];