Refine search picks and cap map fetch

This commit is contained in:
Your Name 2025-12-26 00:49:01 -05:00
parent 252c6b3891
commit 903622e523
3 changed files with 7 additions and 2 deletions

View File

@ -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`;

View File

@ -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 {

View File

@ -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,
});
}
}