From 0647dc823b19df05e7d71bbd590d6bb5712f139e Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 30 Dec 2025 21:11:51 -0500 Subject: [PATCH] Reset cluster focus on time change --- src/components/Map/MapView.jsx | 5 +++++ src/components/Map/usePostsEngine.js | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/Map/MapView.jsx b/src/components/Map/MapView.jsx index 98c234f..013740d 100644 --- a/src/components/Map/MapView.jsx +++ b/src/components/Map/MapView.jsx @@ -59,6 +59,11 @@ export default function MapView({ } catch {} }, [timeHours]); + useEffect(() => { + if (clusterFocus) setClusterFocus(null); + if (mainNewsOnly) setMainNewsOnly(false); + }, [timeHours]); + const stageRef = useRef(null); const [showSubcats, setShowSubcats] = useState(true); diff --git a/src/components/Map/usePostsEngine.js b/src/components/Map/usePostsEngine.js index f448a2e..f44aa8f 100644 --- a/src/components/Map/usePostsEngine.js +++ b/src/components/Map/usePostsEngine.js @@ -1,6 +1,6 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { fetchPosts, fetchSmartFeed, fetchUnifiedSearch } from "../../api/client"; -import { categoryCode, matchesSubFilter, matchesTimeFilter, effectivePostTime } from "./mapFilter"; +import { categoryCode, matchesSubFilter } from "./mapFilter"; import { getCoords, getViewFromMap, haversineKm } from "./mapGeo"; import { createMarkerForPost, createSimpleMarkerForPost } from "./markerManager"; import { getTemplateKeyForPost } from "./templateSpecs"; @@ -867,7 +867,6 @@ export function usePostsEngine({ if (pc !== catCode) return false; } if (!matchesSubFilter(p, subFilter)) return false; - if (!matchesTimeFilter(effectivePostTime(p), tf)) return false; if (!searchResultsRef.current && !matchesSearch(p, searchQuery)) return false; return true; }); @@ -1283,7 +1282,6 @@ export function usePostsEngine({ if (pc !== catCode) return; } if (!matchesSubFilter(p, subFilter)) return; - if (!matchesTimeFilter(effectivePostTime(p), timeHours)) return; if (!matchesSearch(p, searchQuery)) return; if (clusterModeRef.current) {