From a57519040ed3b2148723a755ccf0e6b37670eb17 Mon Sep 17 00:00:00 2001 From: Nafees Nazik <84864519+G3root@users.noreply.github.com> Date: Thu, 16 Mar 2023 01:37:35 +0530 Subject: [PATCH] Fix: hydration error /booking/[uid] (#7732) --- apps/web/components/booking/CancelBooking.tsx | 10 ++- apps/web/pages/booking/[uid].tsx | 63 ++++++++++--------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/apps/web/components/booking/CancelBooking.tsx b/apps/web/components/booking/CancelBooking.tsx index bde168f0ac..dece688720 100644 --- a/apps/web/components/booking/CancelBooking.tsx +++ b/apps/web/components/booking/CancelBooking.tsx @@ -1,5 +1,5 @@ import { useRouter } from "next/router"; -import { useState } from "react"; +import { useCallback, useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import useTheme from "@calcom/lib/hooks/useTheme"; @@ -36,6 +36,13 @@ export default function CancelBooking(props: Props) { const [error, setError] = useState(booking ? null : t("booking_already_cancelled")); useTheme(props.theme); + const cancelBookingRef = useCallback((node: HTMLTextAreaElement) => { + if (node !== null) { + node.scrollIntoView({ behavior: "smooth" }); + node.focus(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); return ( <> {error && ( @@ -54,6 +61,7 @@ export default function CancelBooking(props: Props) {