Refine search picks and cap map fetch
This commit is contained in:
parent
252c6b3891
commit
903622e523
|
|
@ -96,6 +96,9 @@ export async function fetchPosts(filters = {}) {
|
||||||
if (typeof filters.radiusKm === "number") {
|
if (typeof filters.radiusKm === "number") {
|
||||||
params.set("radius_km", String(filters.radiusKm));
|
params.set("radius_km", String(filters.radiusKm));
|
||||||
}
|
}
|
||||||
|
if (typeof filters.limit === "number" && filters.limit > 0) {
|
||||||
|
params.set("limit", String(filters.limit));
|
||||||
|
}
|
||||||
|
|
||||||
const qs = params.toString();
|
const qs = params.toString();
|
||||||
const url = qs ? `${API_BASE}/posts?${qs}` : `${API_BASE}/posts`;
|
const url = qs ? `${API_BASE}/posts?${qs}` : `${API_BASE}/posts`;
|
||||||
|
|
|
||||||
|
|
@ -366,8 +366,8 @@ export default function MapView({
|
||||||
url_hash: raw.url_hash || "",
|
url_hash: raw.url_hash || "",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (kind === 'city') {
|
} else if (kind === 'city' || kind === 'region' || kind === 'place' || kind === 'poi') {
|
||||||
// City pick should move the map without forcing a text filter.
|
// Place picks should move the map without forcing a text filter.
|
||||||
skipAutoZoomRef.current = false;
|
skipAutoZoomRef.current = false;
|
||||||
setSearchQuery("");
|
setSearchQuery("");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -669,6 +669,7 @@ export function usePostsEngine({
|
||||||
lat,
|
lat,
|
||||||
lon: lng,
|
lon: lng,
|
||||||
radiusKm,
|
radiusKm,
|
||||||
|
limit: 120,
|
||||||
});
|
});
|
||||||
if ((!Array.isArray(newPosts) || newPosts.length === 0) && timeFilter !== "PAST") {
|
if ((!Array.isArray(newPosts) || newPosts.length === 0) && timeFilter !== "PAST") {
|
||||||
newPosts = await fetchPosts({
|
newPosts = await fetchPosts({
|
||||||
|
|
@ -678,6 +679,7 @@ export function usePostsEngine({
|
||||||
lat,
|
lat,
|
||||||
lon: lng,
|
lon: lng,
|
||||||
radiusKm,
|
radiusKm,
|
||||||
|
limit: 120,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue