Repository navigation
feat(search): a searched place the atlas holds opens its own page - #555
Conversation
Picking a country, region or town from the search field now opens that region's page instead of the distance-ranked results, when SahajCloud stores the picked Mapbox feature as a Region's `mapboxId`. A locality, neighbourhood or postcode tries the town around it too, never anything coarser. A region holding no class that passes the current filters keeps the search, which lists the nearest classes. The region tree now selects `mapboxId`, so the match is a lookup in the cached tree with no request of its own; a cold cache searches instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The match is a pure, exported `searchedRegionRoute` over the two cached reads, which the field reads at its call site, so it leaves the async `api` object and its module-level memo. It passes over an empty region to the next candidate, so a pick whose own region holds no class still opens the town around it. `withQuery` moves to `path.ts` beside the other route builders, and the same-page guard uses `isCanonicalPath`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The shape is right and the diff is the size of the problem: four new pieces, each with a caller, and the gate reuses the one visibleFeatures predicate rather than inventing a second. The contract holds — Region.mapboxId is required: true, unique: true upstream with no field-level client gate, so the extra select is readable.
What the redirect drops is the picked point: the geocoded bbox/center that placeSearchPath carried. Two reachable picks then leave the map where it was, one with no feedback at all.
Findings
should-fix— a climbed pick onto the page you are already on does nothing:src/views/shared.tsx:324.should-fix— Streamline: foldWITHIN_TOWNinto its one reader:src/lib/geocode.ts:97.consider— an online-only region opens with no framing information:src/config/api/fetch.ts:507.
What was checked
Read whole on the branch: fetch.ts, geocode.ts, path.ts, shared.tsx, use-map-controller-mapbox.tsx, hierarchy.ts, RegionView.tsx. Both keys match what loadRegions/loadGeojson write, and Widget.tsx:148 provides that same module client, so getQueryData hits. preserveSearchState nulls region, so the gate's filters and the destination URL's agree exactly. Change outline matched line by line; both ## Preview lines read "pending" and this repo configures no preview surface.
Consumer side: SahajCloud Regions.ts and src/plugins/access. A city is geocoded as place,locality, covered by the own-id-first order. PLACE_TYPES admits district, which correctly climbs nowhere.
Ladder: no new dependency. Streamliner: 4 pieces, 2 kept, 1 posted. Dropped its other — reading the module queryClient inside searchedRegionRoute would lose the Ladle harness, which seeds regionsQuery().queryKey on its own client (story-harness.tsx:311).
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
A pick of a neighbourhood or postcode inside the town whose page is open resolved to that same page, and the same-page guard then returned: no navigation, no map move, no feedback. Before the redirect that pick opened the distance-ranked search on its point. `searchedRegionRoute` now reports the id that matched beside the route, so the field stays put only when the matched id is the pick's own. A match reached by climbing falls through to `placeSearchPath`, as a pick with no region page already did. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjY9E9Qf29pqPqL8yuK
The set had one reader two lines below it. It is a local now, keeping the `FeatureTypes` literal so a typo fails to compile and the `ReadonlySet<string>` read because the vendor types `feature_type` as a string — a plain `Set<FeatureTypes>.has` of it does not compile. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjY9E9Qf29pqPqL8yuK
|
Two of the three review threads adopted, one back to you.
Lean gate ✓ (2789 passed, 1 skipped). Security sweep of 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | 374152d | Nov 28 2026, 04:49 PM |
There was a problem hiding this comment.
Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is
|
One thread, back to you. Nothing pushed, and the branch is already current with
The thread holds the merge until you choose. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Approved, but this thread still waits on you, and the ruleset will not merge until it is resolved: #555 (comment). Reply there, or resolve it. 🤖 sydevs dispatcher |
A region whose only classes are online has no bounds — `boundsUnder` drops placeless points — so `frameRegion` moved nothing and the map stayed wherever the visitor came from. Searching Ghent opened its page over the last camera. `useFrameableRegion` already answered this for `OnlineView`; the region page now reads it too. It falls back to the region itself rather than skipping the call, because `frameRegion` is also what drops the boundary and the pin the previous view left on the map. Option D of the four offered on the review thread, chosen by the reviewer. SahajCloud serves no region geometry and an online class stores no coordinates, so neither source the other options wanted exists today. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVtMdQvEDvPCuRHHq3
|
One thread, built and resolved. Pushed to a relay branch for Actions to land.
Lean gate green: 2791 passed, 1 skipped. Browser lane green, 39. Two new 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
/search.mapbox_idagainstRegion.mapboxId. There is no extra request.Change outline
Flow — a pick from the search field
Today's pick always pushes
/search. Now it first asks the cached region tree whether the place has a page.Contract — the wholesale region read
The region tree every visitor reads once per stale window now selects one more field.
GET /api/regions select src/config/api/fetch.ts REGIONS_SELECT slug, name, subtitle, level, parent, webPath, webUrl + mapboxId # RegionNodeSchema: z.string().nullish()Camera — a region page with no area of its own
A region's
boundsare the bounds of the LOCATED classes under it, so a place whose only classes are online has none andframeRegionmoved nothing.Files —
withQueryPreview
Test results
test:run(2791 passed, 1 skipped)fetch.test.tssearchedRegionRoute(4),geocode.test.tsgeocodeRegionIds(6),shared.search-pick.test.tsx(4),RegionView.test.tsxframing (2). Each new assertion was watched failing against its defect — the climb assertion againstframeRegion(region), the fallback one againstif (framed) frameRegion(framed).Manual verification
Notes for reviewer
context.place, and for a place asked in three languages.Detail
Self-review (
/code-review medium), dismissed findings:mapboxIdpicks the wrong region: SahajCloud'sRegion.mapboxIdisunique: true, with a unique index (regions_mapbox_id_idx).isCanonicalPath, so encoded slugs match. ⚠ This holds for the pick's OWN id only — a neighbourhood or postcode that merely climbs to this page searches its point instead.Self-review, fixed:
Simplify pass, applied:
searchedRegionRoutetakes the cached reads as arguments, instead of anapimember reading the module singleton. So it follows a provider-scoped client too, as the story harness uses.findreplaces a module-level memo. That memo saved about 7 µs once per pick, at the 646 regions production holds.Simplify pass, kept:
visibleFeaturespluscountUnder, rather than ananyshort-circuit. It stays the one filter predicate. It costs 5–67 µs warm at today's sizes, and its cold occurrence cache is the one the next view fills anyway.Security review (triggered by
src/config/api/): no findings. The route passessafePaththroughregionRoute, and the ids are only compared.Cost:
mapboxIdadds about 23 KB raw, 4–5 KB compressed, to the region tree at 646 regions. That is per visitor per stale window, and it reads beside the feed at boot.🤖 Generated with Claude Code