Search, radius, and distance
Distance behavior needs an origin: latitude and longitude obtained from browser geolocation, a geocoded search, or an explicitly enabled approximate fallback. The distance displayed on a card and used for sorting must come from the same active origin.
One query state
Text search, radius, category, brand, open status, sort, unit, page, and coordinates are parts of one query. Changing one control must preserve the others. For example, adjusting radius after browser geolocation must retain lat and lng; otherwise radius and distance are no longer meaningful.
A typical request includes:
lat=18.62156&lng=73.73553&radius=25&unit=km&sort=distance&page=1&per_page=6
On any filter change, reset to page 1. Load more must reuse the exact query and origin, changing only the page. Do not impose an undocumented fixed maximum radius; validation should reflect the configured/product limit and the UI must enforce the same rule.
Unknown distance
Before an origin exists, hide the distance value or show a complete neutral label such as “Location needed.” Never render a partial phrase such as “About away.” If permission is denied, keep ordinary search usable and offer a clear retry or location search.
Test matrix
Test text only; geolocation only; text plus radius; geolocation then radius change; sort by distance; category plus radius; denied permission; zero results; load more; unit switch; and restoring a locator from browser history.