+3









Syed Ali Shahbaz
GitHub
ali@cal.com <alishahbaz7@gmail.com>
ali@cal.com <alishahbaz7@gmail.com>
ali@cal.com <alishahbaz7@gmail.com>
ali@cal.com <alishahbaz7@gmail.com>
ali@cal.com <alishahbaz7@gmail.com>
ali@cal.com <alishahbaz7@gmail.com>
ali@cal.com <alishahbaz7@gmail.com>
hackice20
Yash
Morgan
Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
4c73695d3a
* fix: refresh slots on timezone change for booker timezone restrictions * refactor: use useMemo for timezone change detection * revert: remove unnecessary formatting changes * feat: add timezone refresh for platform components Add timezone change detection and slot refresh to BookerPlatformWrapper and EventTypeCalendarViewComponent to handle restriction schedules with useBookerTimezone enabled. * refactor: extract timezone slot refresh logic into reusable hook * Update packages/platform/atoms/calendar-view/EventTypeCalendarViewComponent.tsx Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> * Update packages/platform/atoms/calendar-view/EventTypeCalendarViewComponent.tsx Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> * fix * fix: prevent unnecessary getSchedule calls when useBookerTimezone is disabled * fix: add timezone fields to BookerEvent type * fix: add missing properties to BookerEvent and BookerEventProfile types * trying to fix type errors * Add restrictionScheduleId and useBookerTimezone fields * fix: correct import path for useBookerTime hook Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * fix: explicitly include restrictionScheduleId and useBookerTimezone in getPublicEvent return Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * chore: trigger fresh CI build Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * fix: cast event.data to BookerEvent for timezone fields access Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * refactor: address review feedback for timezone slot refresh Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * refactor: add explicit return type to event handler to ensure type propagation Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * refactor: extract useStableTimezone hook and remove dead timezone detection code Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> --------- Co-authored-by: hackice20 <yashkam431@gmail.com> Co-authored-by: Yash <116657771+hackice20@users.noreply.github.com> Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Strategies to prevent error during booking
- The
getSchedulecall, fetches only those slots that are bookable including not showing the slots that are reserved by someone else.- The booking call and the get scheduled call share the same availability checking logic to avoid scenario where
getScheduleconsiders a slot as available but Booking call doesn't consider it available.
- The booking call and the get scheduled call share the same availability checking logic to avoid scenario where
- Even though a slot might be available, multiple people might have opened the same booking page and might want to book the same slot.
- We have a reservation system in place that avoid showing a slot that is reserved by someone to other people.
- The
getSchedulecall itself considers the reservations and doesn't show those slots. - When two persons open the same booking page at the same time, they might will see the same slots.
- If Person1 selects slot1, it will be reserved by Person1. Person2 still sees the slot(because
getScheduleis refetched after a long time(in minutes)). But when Person2 selects the same slot1, he will go to "Slot no-longer available" state.- Also when the Person2, comes back to the slots listing page, he will see the slot as unavailable now. It works because getSchedule would have been fetched by that time which happened when he selected the slot earlier.
- If Person1 selects slot1, it will be reserved by Person1. Person2 still sees the slot(because
- We don't check for reservation during the confirm booking call, because a reservation has lower priority then the actual booking.
"Slot no-longer available" state
- When a slot is no longer available, we disable the "Confirm" button which does the booking.
- We show a message to the user that he should select a different slot.
- To ensure that we can go to this state, whenever applicable, we do the following:
getSchedulefetching. It prevents the unavailable slot to not appear in the list.- Fetched on window focus to handle the users who have the page opened for some time then come back to it
- Fetched every 5 mins(configurable by .env) as well to handle users who are just there on the page for a long time.
- Fetched on selecting a slot.
isReservationquery. It prevents the unavailable slot to be not bookable by the User- Fetched on regular quick intervals(currently every 10s(configurable by .env)). Even though it doesn't detect actual busy/booked slots, it still avoids the attempted booking of a reserved slot.