Avoid filter flicker during smart-feed refresh
This commit is contained in:
parent
df242014bc
commit
1e4807e6f2
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue