fix: don’t let the booking page crash on invalid metadata (#21410)
* fix: booking tab crash * Update zod-utils.ts * Update zod-utils.ts * update
This commit is contained in:
@@ -87,7 +87,9 @@ function buildParsedBooking(booking: BookingItemProps) {
|
||||
>)
|
||||
: null;
|
||||
|
||||
const bookingMetadata = bookingMetadataSchema.parse(booking.metadata ?? null);
|
||||
const parsedMetadata = bookingMetadataSchema.safeParse(booking.metadata ?? null);
|
||||
const bookingMetadata = parsedMetadata.success ? parsedMetadata.data : null;
|
||||
|
||||
return {
|
||||
...booking,
|
||||
eventType: bookingEventType,
|
||||
|
||||
@@ -129,7 +129,9 @@ export default function Success(props: PageProps) {
|
||||
rescheduleLocation = bookingInfo.responses.location.optionValue;
|
||||
}
|
||||
|
||||
const parsedBookingMetadata = bookingMetadataSchema.parse(bookingInfo?.metadata || {});
|
||||
const parsed = bookingMetadataSchema.safeParse(bookingInfo?.metadata ?? null);
|
||||
const parsedBookingMetadata = parsed.success ? parsed.data : null;
|
||||
|
||||
const bookingWithParsedMetadata = {
|
||||
...bookingInfo,
|
||||
metadata: parsedBookingMetadata,
|
||||
|
||||
Reference in New Issue
Block a user