From 68c3648768337651d9737add5a5054fdc045d237 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 18 Dec 2025 22:39:29 -0500 Subject: [PATCH] blehh --- deploy.sh | 0 src/components/Map/usePostsEngine.js | 43 +++++++++++++++------------- src/styles/overlays.css | 5 ++-- 3 files changed, 25 insertions(+), 23 deletions(-) mode change 100644 => 100755 deploy.sh diff --git a/deploy.sh b/deploy.sh old mode 100644 new mode 100755 diff --git a/src/components/Map/usePostsEngine.js b/src/components/Map/usePostsEngine.js index bbdc7a2..6b69fed 100644 --- a/src/components/Map/usePostsEngine.js +++ b/src/components/Map/usePostsEngine.js @@ -22,16 +22,21 @@ export function usePostsEngine({ const [loadingPosts, setLoadingPosts] = useState(false); const [loadError, setLoadError] = useState(""); + const isExpandedOpen = () => { + try { + return !!expandedElRef?.current; + } catch { + return false; + } + }; + const rebuildMarkersForFilters = useCallback( (tf) => { const map = mapRef.current; if (!map) return; - // If expanded is open and we are inside ignore window, do not rebuild (it closes the popup) - try { - const until = map.__swIgnoreRebuildUntil || 0; - if (expandedElRef?.current && until && Date.now() < until) return; - } catch {} + // ✅ If expanded overlay/popup is open: NEVER rebuild markers (it closes the expanded) + if (isExpandedOpen()) return; clearAllMarkers(markersRef, expandedElRef); @@ -57,6 +62,7 @@ export function usePostsEngine({ ); useEffect(() => { + // ✅ Sociowall list can still update via visiblePosts; markers rebuild is blocked while expanded open. rebuildMarkersForFilters(timeFilter); }, [timeFilter, mainFilter, subFilter, rebuildMarkersForFilters]); @@ -68,18 +74,12 @@ export function usePostsEngine({ let cancelled = false; async function load() { - const mapObj = mapRef.current; - - // Delay fetch while popup is open (prevents marker clear/rebuild) - try { - const until = mapObj?.__swIgnoreFetchUntil || 0; - if (until && Date.now() < until) { - const wait = Math.min(4000, until - Date.now()); - if (delayedFetchRef.current) clearTimeout(delayedFetchRef.current); - delayedFetchRef.current = setTimeout(load, wait + 25); - return; - } - } catch {} + // ✅ If expanded is open: delay fetch indefinitely until user closes it + if (isExpandedOpen()) { + if (delayedFetchRef.current) clearTimeout(delayedFetchRef.current); + delayedFetchRef.current = setTimeout(load, 1200); + return; + } const [lng, lat] = viewParams.center; const radiusKm = viewParams.radiusKm || 750; @@ -93,7 +93,6 @@ export function usePostsEngine({ const lastR = last.radiusKm || 0; const radiusChanged = !lastR || Math.abs(radiusKm - lastR) / Math.max(lastR, 1) >= 0.25; - const minMoveKm = Math.max(50, radiusKm * 0.25); if (!radiusChanged && distKm < minMoveKm) return; @@ -133,7 +132,9 @@ export function usePostsEngine({ allPostsRef.current = Array.from(byId.values()); lastFetchRef.current = { center: [...viewParams.center], radiusKm, filterKey }; - rebuildMarkersForFilters(timeFilter); + // ✅ rebuild markers only if expanded is NOT open (double-safety) + if (!isExpandedOpen()) rebuildMarkersForFilters(timeFilter); + setLoadingPosts(false); } catch (err) { console.error("Erreur chargement posts:", err); @@ -149,7 +150,9 @@ export function usePostsEngine({ return () => { cancelled = true; if (delayedFetchRef.current) { - try { clearTimeout(delayedFetchRef.current); } catch {} + try { + clearTimeout(delayedFetchRef.current); + } catch {} delayedFetchRef.current = null; } }; diff --git a/src/styles/overlays.css b/src/styles/overlays.css index 8f1f221..b910a33 100644 --- a/src/styles/overlays.css +++ b/src/styles/overlays.css @@ -15,10 +15,9 @@ display:flex; flex-direction:column; gap:.5rem; } -/* ✅ Sub-categories row MUST stay above the Sociowall overlap - ✅ And move DOWN by ~10px (less bottom padding) */ +/* ✅ sub-cats: keep above wall overlap + moved DOWN by 10px more */ .map-overlay-bottom{ - bottom: calc(2.6rem + var(--sw-below-overlap, 0px) + env(safe-area-inset-bottom)); + bottom: calc(2.6rem + var(--sw-below-overlap, 0px) + env(safe-area-inset-bottom) - 20px); left:50%; transform:translateX(-50%); display:flex;