fix: avoid stingifying undefined to session storage

This commit is contained in:
Christel Westerberg
2024-12-20 09:44:03 +01:00
parent 0c7c6ea21a
commit f7e396ff50

View File

@@ -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 {