Repository navigation
fix(map): frame the parent region on a deep link to a placeless event - #363
Conversation
An online event usually has no stored coordinates. frameEvent found no point and returned, so a direct link such as /ca/ontario/toronto/720 left the camera on the boot-time world view. Region links were unaffected, since they frame from the region's bounds. The event, register and share views now share useFrameEventOnTop. An event with a point frames as before. One without frames its parent region, only as the session entry point, matching OnlineView. The region read is a plain useQuery on RegionView's key, so the drawer never waits on it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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: one hook replacing three identical call sites, one predicate, one CHANGELOG entry. Nothing is smuggled in.
Two things stop it being finished. The predicate it adds already exists as eventPoint, and frameEvent acts on that copy, so the two can drift into framing nothing. And the new fallback is itself a silent no-op for an online-only region, whose bounds come back null — so the CHANGELOG's unconditional promise does not hold there.
Contract surfaces are clean. No attribute, origin, CSP or URL-shape change, so docs/embedding.md needs nothing, and src/types/payload/ is untouched.
Findings
- should-fix —
hasMapPointis a second definition ofeventPoint's own point test (src/lib/camera.ts:88). - should-fix — the region fallback moves nothing when the region has no located events (
src/views/shared.tsx:365). - consider —
OnlineViewholds the same entry-only region rule this hook now owns (src/views/shared.tsx:350).
What was checked
Read whole: views/shared.tsx, lib/camera.ts, both map-controller modules, OnlineView, RegionView, frame-on-top.test.tsx, types/region-ref.ts, getRegion, boundsUnder.
Ladder, on the two new pieces: useFrameEventOnTop earns three call sites; hasMapPoint does not. No new dependency, type or constant.
Traced the extra render the async region read introduces. useFrameOnTop's activeView guard refuses a stale view, and rememberCamera writes only at navigation, so restore cannot hijack the second effect run. That path is sound.
event.region is nullish only for an unaccepted live-preview proposal, and the optional read covers it.
The body carries no preview link to open. Profile read: its test-coverage exclusion is why the untested hook is not a finding.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
hasMapPoint and eventPoint each decided whether an event has coordinates to frame. Two tests that disagreed would leave frameEvent running on an event it then frames nothing for, reverting the region fallback in silence. hasMapPoint now narrows, and eventPoint reads its coordinates through it. One verdict, so the camera and the fallback cannot part company. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYTKpFDQWpqmMpZhwQ
A region's bounds are the bounds of the located events under it, so a city whose only classes are online has none and frameRegion moves nothing. That is the city an online class most often sits in, so the deep-link fallback was itself a no-op there and the link still opened over the world map. useFrameableRegion now takes the nearest region at or above the event's that has bounds. Only an unframeable region reads the ancestry, so the common case stays one cached read. ancestorSlugs carries the walk, in lib/shape. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYTKpFDQWpqmMpZhwQ
The online-classes drawer framed the region it lists, and a region whose only classes are online has no bounds — which is every region this drawer is reached from a deep link for. It now shares useFrameableRegion with the event views, so one climb serves both, while the list still renders the region itself. The framing call stays at each call site. useFrameOnTop also owns the POP restore, so two instances in one view would restore twice and frameRegion would clear the point the other had just set. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYTKpFDQWpqmMpZhwQ
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYTKpFDQWpqmMpZhwQ
|
Addressed all three critic threads. Pushed
One correction: Lean gate green. Not browser-checked — this clone holds no SahajCloud or Mapbox key, so 🤖 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 | 2981408 | Nov 05 2026, 05:18 PM |
Brings main's 14 commits (#363-#380) into the combined review build. Non-obvious resolutions: - Clock rule (#380): an in-person time names the venue's clock only when the viewer's differs, an online time always. Replaces the proposals' "every time names its clock". The calendar's TimesNote now says main's one sentence (calendar.times_note), only when an online class is listed, kept above the grid and the week list; its times_city/times_local/times_online keys are gone. Add-a-class Check still spells out the inferred clock once, now added there itself. - Camera padding (#369): the proposals' useClassSheet stays and now reports the peek while the sheet is collapsed; main's useSheetCover, fitSheet marker and fit-snap rewrite are dropped for the proposals' own fit-snap. - World view (#370): world copies back on with main's minZoom, per its Pacific-wrap fix, under the proposals' map controls. - Place search (#371): the proposals' "search all countries" button stays; main's ?cc / browsed-country fallback, per-query release and "couldn't find that place" line are ported into it. - Ancestry (#371): placedPathname/placePathsOf live once, in navigation.ts; DrawerStack's stack follows the region tree. - Deep links to placeless events frame their region (#363), via useFrameEventOnTop, which skips contact-only listings. - Kept proposal designs over main's: registration confirmation, Add to calendar list, consent link, GeolocationSuggestion placement, filter tags in ListToolbar, map control column. Main's failure copy (#365), autofill, by-request type label (#370) and dead-place header (#371) are ported in. - streetAndCity: the proposals' version, now accent-blind as main's is. - Width pin for the per-edit hook ratcheted 20 -> 21 (both sides added one spec). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem
A direct link to an event doesn't zoom the map: https://sahajatlas.com/ca/ontario/toronto/720 opens the event drawer over the world view. Region links such as
/ca/ontario/toronto/zoom correctly.Event 720 is an online class. SahajCloud returns it with
address.latitudeandaddress.longitudebothnull.frameEventderives no point from that and returns early, so nothing moves the camera off the boot-time world view.Fix
useFrameEventOnTop(event)insrc/views/shared.tsx, used byEventView,RegistrationViewandShareView(all three framed the same way before).OnlineView. Opening a placeless event in-session still leaves the camera where it is.useFrameableRegion(regionSlug)decides which region: the nearest one at or above it that has bounds. A region's bounds are the bounds of the located events under it —boundsUnderdrops placeless points — so a city whose only classes are online has none, andframeRegionmoves nothing there. That is the city an online class most often sits in, so without the climb the fallback was itself a no-op for the common case.ancestorSlugs(src/lib/shape/hierarchy.ts) carries the walk, with unit tests.useQuery/useQuerieson RegionView's['region', slug, locale]key, so the drawer never suspends on a fetch only the camera needs. Disabled whenmap=false.OnlineViewshares that hook. It lists a region whose bounds are null by definition, so its own framing was the same no-op on a deep link. It still renders its own region; only the camera climbs.hasMapPointinsrc/lib/camera.tsnow narrows, andeventPoint(use-map-controller-real.tsx) reads its coordinates through it. One verdict, soframeEventand the fallback cannot disagree.Verification
.claude/skills/pr-prep/check.sh): lint, typecheck and 1899 unit tests pass.hasMapPointagainst a falsy check that drops a0coordinate,ancestorSlugsagainst a reversed chain and against a dropped unknown-slug fallback.pnpm dev, at4cef2f9— before this review round:/ca/ontario/toronto/720framed Toronto. The same URL on production stayed on the world map.Notes for reviewer
OnlineViewpath are not browser-checked. This routine clone holds noVITE_SAHAJCLOUD_API_KEYorVITE_MAPBOX_ACCESSTOKEN, sopnpm devserves the configuration-error screen with no map. They rest on the unit lane and on review. Also not browser-checked: an event with coordinates (unchanged path), and the/registerand/sharedeep links.OnlineViewkeeps its ownuseFrameOnTopcall rather than moving it into the hook. That hook also owns the POP restore, so two instances in one view would restore twice, andframeRegion'ssetSelection(null)would clear the point the other had just set.No parameter, origin, CSP or URL-shape change.
/api/regionsis already read at boot, so the climb adds no origin.🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjYTKpFDQWpqmMpZhwQ