diff --git a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx
index 67b23d5f..abbe2a67 100644
--- a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx
+++ b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx
@@ -116,10 +116,9 @@ export const SearchControl = () => {
{itemsResults.slice(0, 5).map(item => (
{
const marker = Object.entries(leafletRefs).find(r => r[1].item == item)?.[1].marker;
- if(marker){
+ resetFilterTags();
+ if(marker && filterTags.length == 0){
navigate(`/${item.layer.name}/${item.id}`)
-
-
}
else {
navigate("item/"+item.id)
diff --git a/src/Components/Profile/OverlayItemProfile.tsx b/src/Components/Profile/OverlayItemProfile.tsx
index f2424cea..2f70f0b0 100644
--- a/src/Components/Profile/OverlayItemProfile.tsx
+++ b/src/Components/Profile/OverlayItemProfile.tsx
@@ -36,7 +36,6 @@ export function OverlayItemProfile() {
const updateItem = useUpdateItem();
const [item, setItem] = useState- ({} as Item)
const map = useMap();
- const windowDimension = useWindowDimensions();
const layers = useLayers();
const selectPosition = useSelectPosition();
const removeItem = useRemoveItem();
@@ -77,8 +76,12 @@ export function OverlayItemProfile() {
const itemId = location.pathname.split("/")[2];
const item = items.find(i => i.id === itemId);
item && setItem(item);
- resetFilterTags();
- if (item && filterTags.length == 0) {
+
+
+ }, [items,location])
+
+ useEffect(() => {
+ if (item) {
if(item.position) {
const marker = Object.entries(leafletRefs).find(r => r[1].item == item)?.[1].marker;
marker && clusterRef?.zoomToShowLayer(marker, () => {
@@ -97,8 +100,9 @@ export function OverlayItemProfile() {
);
}
}
+ }, [item])
+
- }, [items, activeTab, leafletRefs])
useEffect(() => {
@@ -116,7 +120,7 @@ export function OverlayItemProfile() {
const item = items.find(i => i.id == r.related_items_id)
item && setRelations(current => [...current, item])
})
- }, [item, items])
+ }, [item])
useEffect(() => {
item && item.user_created && hasUserPermission("items", "update", item) && setUpdatePermission(true);
@@ -234,7 +238,7 @@ export function OverlayItemProfile() {
return (
<>
{item &&
-
+
<>
navigate("/edit-item/" + item.id)} setPositionCallback={()=>{map.closePopup();setSelectPosition(item); navigate("/")}} big />