diff --git a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx index 6b543b208a7848..9c079b85722c1c 100644 --- a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx +++ b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx @@ -381,15 +381,17 @@ export const BookerPlatformWrapper = ( }); setBookingData(null); } - if (isOverlayCalendarEnabled) { - localStorage.setItem("overlayCalendarSwitchDefault", "true"); - } else { - localStorage.removeItem("overlayCalendarSwitchDefault"); - } }; // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + useEffect(() => { + if (isOverlayCalendarEnabled && view === "MONTH_VIEW") { + localStorage.removeItem("overlayCalendarSwitchDefault"); + } + setIsOverlayCalendarEnabled(Boolean(localStorage?.getItem?.("overlayCalendarSwitchDefault"))); + }, [view, isOverlayCalendarEnabled]); + return (