From f7e396ff5073974897f743117f909e3280edf3e4 Mon Sep 17 00:00:00 2001 From: Christel Westerberg Date: Fri, 20 Dec 2024 09:44:03 +0100 Subject: [PATCH] fix: avoid stingifying undefined to session storage --- components/Forms/BookingWidget/FormContent/Search/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/Forms/BookingWidget/FormContent/Search/index.tsx b/components/Forms/BookingWidget/FormContent/Search/index.tsx index 972982337..cc9c7b275 100644 --- a/components/Forms/BookingWidget/FormContent/Search/index.tsx +++ b/components/Forms/BookingWidget/FormContent/Search/index.tsx @@ -162,7 +162,9 @@ export default function Search({ locations, handlePressEnter }: SearchProps) { }, [stayType, stayValue, unregister, setValue]) useEffect(() => { - sessionStorage.setItem(sessionStorageKey, locationString) + if (locationString) { + sessionStorage.setItem(sessionStorageKey, locationString) + } }, [locationString]) function getLocationLabel(): string {