Show fallback posts when bounds empty
This commit is contained in:
parent
68cb21fc23
commit
d7bf3e22cb
|
|
@ -537,6 +537,9 @@ export function usePostsEngine({
|
||||||
if (vBounded.length === 0 && viewParams?.center && viewParams?.radiusKm) {
|
if (vBounded.length === 0 && viewParams?.center && viewParams?.radiusKm) {
|
||||||
vBounded = filterByRadius(vAll, viewParams.center, viewParams.radiusKm * 1.2);
|
vBounded = filterByRadius(vAll, viewParams.center, viewParams.radiusKm * 1.2);
|
||||||
}
|
}
|
||||||
|
if (vBounded.length === 0) {
|
||||||
|
vBounded = vAll;
|
||||||
|
}
|
||||||
let v = vBounded;
|
let v = vBounded;
|
||||||
if (v.length > MAX_VISIBLE_POSTS) {
|
if (v.length > MAX_VISIBLE_POSTS) {
|
||||||
const center = map?.getCenter?.();
|
const center = map?.getCenter?.();
|
||||||
|
|
@ -723,15 +726,12 @@ export function usePostsEngine({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const delay = initialLoadRef.current ? 0 : 2400;
|
|
||||||
initialLoadRef.current = false;
|
|
||||||
if (moveDebounceRef.current) {
|
if (moveDebounceRef.current) {
|
||||||
clearTimeout(moveDebounceRef.current);
|
clearTimeout(moveDebounceRef.current);
|
||||||
moveDebounceRef.current = null;
|
moveDebounceRef.current = null;
|
||||||
}
|
}
|
||||||
moveDebounceRef.current = setTimeout(() => {
|
initialLoadRef.current = false;
|
||||||
if (!cancelled) load();
|
load();
|
||||||
}, delay);
|
|
||||||
return () => {
|
return () => {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
if (moveDebounceRef.current) {
|
if (moveDebounceRef.current) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue