Reset cluster focus on time change

This commit is contained in:
Your Name 2025-12-30 21:11:51 -05:00
parent ae61e19e09
commit 0647dc823b
2 changed files with 6 additions and 3 deletions

View File

@ -59,6 +59,11 @@ export default function MapView({
} catch {} } catch {}
}, [timeHours]); }, [timeHours]);
useEffect(() => {
if (clusterFocus) setClusterFocus(null);
if (mainNewsOnly) setMainNewsOnly(false);
}, [timeHours]);
const stageRef = useRef(null); const stageRef = useRef(null);
const [showSubcats, setShowSubcats] = useState(true); const [showSubcats, setShowSubcats] = useState(true);

View File

@ -1,6 +1,6 @@
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import { fetchPosts, fetchSmartFeed, fetchUnifiedSearch } from "../../api/client"; 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 { getCoords, getViewFromMap, haversineKm } from "./mapGeo";
import { createMarkerForPost, createSimpleMarkerForPost } from "./markerManager"; import { createMarkerForPost, createSimpleMarkerForPost } from "./markerManager";
import { getTemplateKeyForPost } from "./templateSpecs"; import { getTemplateKeyForPost } from "./templateSpecs";
@ -867,7 +867,6 @@ export function usePostsEngine({
if (pc !== catCode) return false; if (pc !== catCode) return false;
} }
if (!matchesSubFilter(p, subFilter)) return false; if (!matchesSubFilter(p, subFilter)) return false;
if (!matchesTimeFilter(effectivePostTime(p), tf)) return false;
if (!searchResultsRef.current && !matchesSearch(p, searchQuery)) return false; if (!searchResultsRef.current && !matchesSearch(p, searchQuery)) return false;
return true; return true;
}); });
@ -1283,7 +1282,6 @@ export function usePostsEngine({
if (pc !== catCode) return; if (pc !== catCode) return;
} }
if (!matchesSubFilter(p, subFilter)) return; if (!matchesSubFilter(p, subFilter)) return;
if (!matchesTimeFilter(effectivePostTime(p), timeHours)) return;
if (!matchesSearch(p, searchQuery)) return; if (!matchesSearch(p, searchQuery)) return;
if (clusterModeRef.current) { if (clusterModeRef.current) {