mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-04-06 01:25:33 +00:00
only update browser url if no profile is open
This commit is contained in:
parent
9092241461
commit
ccb667c7cc
@ -160,20 +160,28 @@ export function UtopiaMapInner({
|
|||||||
useMapEvents({
|
useMapEvents({
|
||||||
popupopen: (e) => {
|
popupopen: (e) => {
|
||||||
const item = Object.entries(leafletRefs).find((r) => r[1].popup === e.popup)?.[1].item
|
const item = Object.entries(leafletRefs).find((r) => r[1].popup === e.popup)?.[1].item
|
||||||
if (window.location.pathname.split('/')[1] !== item?.id) {
|
|
||||||
if (!location.pathname.includes('/item/') && item?.id) {
|
// Only update URL if no profile is open
|
||||||
|
if (!location.pathname.includes('/item/')) {
|
||||||
|
if (window.location.pathname.split('/')[1] !== item?.id && item?.id) {
|
||||||
setItemInUrl(item.id)
|
setItemInUrl(item.id)
|
||||||
}
|
}
|
||||||
if (item?.name) {
|
if (item?.name) {
|
||||||
updateMetaTags(item.name, item.text)
|
updateMetaTags(item.name, item.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If profile is open, don't change URL but still update meta tags
|
||||||
|
else if (item?.name) {
|
||||||
|
updateMetaTags(item.name, item.text)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
popupclose: () => {
|
popupclose: () => {
|
||||||
// Remove UUID from URL when popup closes
|
// Only remove UUID from URL if no profile is open
|
||||||
if (containsUUID(window.location.pathname)) {
|
if (!location.pathname.includes('/item/')) {
|
||||||
removeItemFromUrl()
|
if (containsUUID(window.location.pathname)) {
|
||||||
resetMetaTagsUtil()
|
removeItemFromUrl()
|
||||||
|
resetMetaTagsUtil()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user