fix(GRO-2105): include serviceId in BookingFlow/RescheduleFlow availability call #46
Reference in New Issue
Block a user
Delete Branch "flea/gro-2105-booking-availability-fix"
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
Both portal flows (
BookingFlowandRescheduleFlowinsrc/portal/sections/Appointments.tsx) were callingGET /api/book/availabilitywith only thedatequery param. The API responded400 {error:"serviceId and date are required"}and the React handler called.map()on that error object, throwingTypeError: ee.map is not a functionand wiping<div id="root">. The entire page went blank.This restores the test cases blocked by GRO-2105 — TC-WEB-5.12.5 through 5.12.11 in
UAT_PLAYBOOK.md§5.12b.Changes
fetchAvailability({serviceId, date}, sessionId)inAppointments.tsxthat:res.ok(returns the API'serrorstring on 4xx/5xx instead of letting.map()crash)Failed to load time slotsmessageappt.serviceId(the appointment's existing service).selectedServices[0]?.id(matches the sameserviceIdalready used when the booking is submitted).cancelledflag prevents stale responses from overwriting state when the date changes mid-flight.Tests
/api/book/availability?date=…) to expect the correct URL withserviceId.4xxwith a{error}body, and one for a200with a non-array body. Both assert the error message is shown and the page does not crash.Verification
pnpm test→ 141 / 141 passpnpm run typecheck→ cleanpnpm run lint→ 0 errors (3 pre-existing warnings, unrelated)pnpm run build→ clean, bundle includesserviceIdand the error-path stringsUAT Playbook
Updated
UAT_PLAYBOOK.md§5.12b to clarify that the call must includeserviceIdand that the error state must keep the page interactive (no white screen).Flea Flicker referenced this pull request2026-06-08 01:14:01 +00:00