In this episode, we tackle a really crucial part of the booking process: checking if an appointment slot is still available right before someone submits their booking. You might have noticed that, if two people are booking at nearly the same time, it's possible for the same slot to be double-booked if we don't do a final check!
Here's how we handle it:
The demo walks through testing this—by faking some bookings directly in the database to simulate the race condition—so you can actually see the error message pop up if you try to book an unavailable slot. We round off with handling success and error feedback in the UI, so the user experience is nice and smooth.
By the end, you'll have a robust check in place to prevent double bookings. Even if two people pick the same slot at the same time, only the first to submit a successful booking gets it!