Skip to content

Scheduling infrastructure for absolutely everyone.

fix: overlay calendar view for `Booker` atom (#16642)

Rajiv Sahal071c899ea6bd
diff --git a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx
index 6b543b208a7..9c079b85722 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 (
<AtomsWrapper>
<BookerComponent