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") {
|
||||
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 url = qs ? `${API_BASE}/posts?${qs}` : `${API_BASE}/posts`;
|
||||
|
|
|
|||
|
|
@ -366,8 +366,8 @@ export default function MapView({
|
|||
url_hash: raw.url_hash || "",
|
||||
});
|
||||
}
|
||||
} else if (kind === 'city') {
|
||||
// City pick should move the map without forcing a text filter.
|
||||
} else if (kind === 'city' || kind === 'region' || kind === 'place' || kind === 'poi') {
|
||||
// Place picks should move the map without forcing a text filter.
|
||||
skipAutoZoomRef.current = false;
|
||||
setSearchQuery("");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -669,6 +669,7 @@ export function usePostsEngine({
|
|||
lat,
|
||||
lon: lng,
|
||||
radiusKm,
|
||||
limit: 120,
|
||||
});
|
||||
if ((!Array.isArray(newPosts) || newPosts.length === 0) && timeFilter !== "PAST") {
|
||||
newPosts = await fetchPosts({
|
||||
|
|
@ -678,6 +679,7 @@ export function usePostsEngine({
|
|||
lat,
|
||||
lon: lng,
|
||||
radiusKm,
|
||||
limit: 120,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue