fix(gro-158): admin page blank — TypeError: b.filter is not a function #141

Merged
groombook-engineer[bot] merged 1 commits from fix/gro-158-admin-blank-filter into main 2026-03-28 02:53:20 +00:00

1 Commits

Author SHA1 Message Date
Barkley Trimsworth 2232d9d1f5 fix(gro-158): add r.ok checks before .json() in AppointmentsPage and fix DevLoginSelector userId fallback
Two fixes for the admin page blank / TypeError: b.filter issue:

1. Appointments.tsx: Add r.ok status checks before calling r.json() on
   /api/clients, /api/services, and /api/staff. Previously, 403/404 error
   responses would have their JSON bodies (e.g. {error:"Forbidden"}) passed
   to state setters, causing Array.prototype.filter to fail on non-array
   objects. Now errors are thrown and caught by the existing .catch() handler,
   setting the error state instead.

2. DevLoginSelector.tsx: Add userId field to StaffUser and use
   s.userId ?? s.id when calling selectUser. If the API returns a non-null
   userId (post-migration), that is used as the dev login identifier;
   otherwise falls back to staff.id (pre-migration records where userId
   is null).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-28 02:20:35 +00:00