Skip to content

fix(map): frame the parent region on a deep link to a placeless event - #363

Merged
Ardnived merged 6 commits into
mainfrom
fix/event-deeplink-zoom
Nov 5, 2026
Merged

Ardnived merged 6 commits into
mainfrom
fix/event-deeplink-zoom

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

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.latitude and address.longitude both null. frameEvent derives no point from that and returns early, so nothing moves the camera off the boot-time world view.

Fix

  • New useFrameEventOnTop(event) in src/views/shared.tsx, used by EventView, RegistrationView and ShareView (all three framed the same way before).
    • An event with coordinates frames exactly as before.
    • An event without them frames a region, but only as the session entry point (a deep link). This matches 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 — boundsUnder drops placeless points — so a city whose only classes are online has none, and frameRegion moves 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.
    • Only an unframeable region reads the ancestry, so the common case stays one read.
    • Both reads are plain useQuery/useQueries on RegionView's ['region', slug, locale] key, so the drawer never suspends on a fetch only the camera needs. Disabled when map=false.
  • OnlineView shares 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.
  • hasMapPoint in src/lib/camera.ts now narrows, and eventPoint (use-map-controller-real.tsx) reads its coordinates through it. One verdict, so frameEvent and the fallback cannot disagree.

Verification

  • Lean gate (.claude/skills/pr-prep/check.sh): lint, typecheck and 1899 unit tests pass.
  • New assertions watched to fail first: hasMapPoint against a falsy check that drops a 0 coordinate, ancestorSlugs against a reversed chain and against a dropped unknown-slug fallback.
  • Headless Chromium against pnpm dev, at 4cef2f9 — before this review round: /ca/ontario/toronto/720 framed Toronto. The same URL on production stayed on the world map.

Notes for reviewer

  • The climb and the OnlineView path are not browser-checked. This routine clone holds no VITE_SAHAJCLOUD_API_KEY or VITE_MAPBOX_ACCESSTOKEN, so pnpm dev serves 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 /register and /share deep links.
  • The climb stops where the whole ancestry is online-only: a country with no in-person classes has no bounds at any level, so such a link still opens on the world map. The CHANGELOG states this.
  • OnlineView keeps its own useFrameOnTop call rather than moving it into the hook. That hook also owns the POP restore, so two instances in one view would restore twice, and frameRegion's setSelection(null) would clear the point the other had just set.

No parameter, origin, CSP or URL-shape change. /api/regions is already read at boot, so the climb adds no origin.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjYTKpFDQWpqmMpZhwQ

Ardnived and others added 2 commits November 5, 2026 09:45
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]>
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 5, 2026
@sydevs-bot

sydevs-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 16:58Z address-review · attempt 1 · session · done
  • 16:58Z address-review · attempt 1 · session
  • 16:49Z review-pr · attempt 1 · session · done
  • 16:49Z review-pr · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 5, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 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 — hasMapPoint is a second definition of eventPoint'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 — OnlineView holds 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

Comment thread src/lib/camera.ts Resolved
Comment thread src/views/shared.tsx Resolved
Comment thread src/views/shared.tsx Resolved
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 5, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 5, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 5, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 5, 2026
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
@sydevs-bot

Copy link
Copy Markdown
Contributor

Addressed all three critic threads. Pushed 2981408 for Actions to land on fix/event-deeplink-zoom.

One correction: EmptyEventList does not climb the ancestry; it renders a search field.

Lean gate green. Not browser-checked — this clone holds no SahajCloud or Mapbox key, so pnpm dev serves the configuration-error screen. The PR notes say which paths that leaves unchecked.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 5, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 5, 2026
@sydevs-bot
sydevs-bot enabled auto-merge November 5, 2026 17:20
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
sahajatlas-design 2981408 Nov 05 2026, 05:18 PM

@Ardnived
Ardnived merged commit c1444d4 into main Nov 5, 2026
11 checks passed
@Ardnived
Ardnived deleted the fix/event-deeplink-zoom branch November 5, 2026 17:40
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 5, 2026
antontcymbal added a commit that referenced this pull request Nov 10, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants