Avoid filter flicker during smart-feed refresh

This commit is contained in:
Your Name 2025-12-30 19:24:34 -05:00
parent df242014bc
commit 1e4807e6f2
1 changed files with 4 additions and 0 deletions

View File

@ -947,6 +947,7 @@ export function usePostsEngine({
// On view change: re-filter markers/cards to current bounds even without fetch
useEffect(() => {
if (pendingFilterRef.current) return;
refreshVisibleAndMarkers(timeFilter);
}, [viewParams, refreshVisibleAndMarkers, timeFilter]);
@ -1129,6 +1130,9 @@ export function usePostsEngine({
} catch (err) {
setLoadingPosts(false);
setLoadError("fetch failed");
if (pendingFilterRef.current === currentKey) {
pendingFilterRef.current = "";
}
const key = `${filterKey}|${Math.round(lat * 100)}|${Math.round(lng * 100)}|${Math.round(radiusKm)}`;
const now = Date.now();
if (retryRef.current.key !== key || now - retryRef.current.ts > 5000) {