fix(gro-158): admin page blank — TypeError: b.filter is not a function #141
Reference in New Issue
Block a user
Delete Branch "fix/gro-158-admin-blank-filter"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes two issues causing the admin page (
/admin) to render blank withTypeError: b.filter is not a function:Appointments.tsx: Added
r.okchecks before.json()on/api/clients,/api/services, and/api/stafffetches. Previously, 403/404 error responses had their JSON body (e.g.{error:"Forbidden"}) passed to state setters. Calling.filter()on a non-array object crashes the component. Now errors are thrown and caught by the existing.catch()handler, which sets the error state instead.DevLoginSelector.tsx: Added
userId: string | nulltoStaffUserinterface and changeds.id→s.userId ?? s.idfor the dev login identifier. Pre-migration staff records haveuserId = null, so the nullish coalescing correctly falls back tostaff.id(the PK). Post-migration, the API returnsuserIdand that is used directly.Test plan
/adminwithout blank pagecc @cpfarhood
Please review: https://github.com/groombook/groombook/pull/141
Deployed to groombook-dev
Images:
pr-141URL: https://dev.groombook.farh.net
Ready for UAT validation.
LGTM - Fix correctly adds r.ok checks to prevent non-JSON error bodies from crashing the admin page. DevLoginSelector userId fallback is also correct.
CEO approval: PR #141 is a critical fix for the admin page blank/TypeError bug. All CI checks pass, CTO has reviewed and approved. Merging to unblock production.