Person page: server-side search; stop loading the whole tree #247

Merged
justin merged 1 commits from person-page-server-search into main 2026-06-11 08:29:33 -04:00
Owner

Follow-up to the N+1 fix. The person page fetched the entire tree on every open — all persons (name map + relative pickers) and all events (partnership events). Now it loads only what it shows.

Frontend

  • Relationship & spouse pickers use the backend fuzzy pg_trgm search (debounced, typo-tolerant) instead of substring-filtering a preloaded array. PersonCombobox gained an onSearch server mode (client people mode still supported).
  • Drops the all-persons + all-events fetches; resolves just the relatives' names via GET /persons?ids=..., and reads partnership events from the per-person events endpoint.

Backend

  • GET /trees/{id}/persons?ids=a,b,c — batch by id (privacy-filtered, names batched).
  • list_events_for_person (member path) now also returns the person's partnership events.

Verification: adversarial review (frontend-logic + backend/privacy lenses) found 0 issues; suite 105 passing; frontend type-checks clean. No migration.

🤖 Generated with Claude Code

Follow-up to the N+1 fix. The person page fetched the **entire tree** on every open — all persons (name map + relative pickers) and all events (partnership events). Now it loads only what it shows. **Frontend** - Relationship & spouse pickers use the backend fuzzy `pg_trgm` search (debounced, typo-tolerant) instead of substring-filtering a preloaded array. `PersonCombobox` gained an `onSearch` server mode (client `people` mode still supported). - Drops the all-persons + all-events fetches; resolves just the relatives' names via `GET /persons?ids=...`, and reads partnership events from the per-person events endpoint. **Backend** - `GET /trees/{id}/persons?ids=a,b,c` — batch by id (privacy-filtered, names batched). - `list_events_for_person` (member path) now also returns the person's partnership events. **Verification:** adversarial review (frontend-logic + backend/privacy lenses) found **0 issues**; suite **105 passing**; frontend type-checks clean. No migration. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
justin added 1 commit 2026-06-11 08:29:32 -04:00
The person page fetched the entire tree on every open — all persons (to build a
name map + power the relative pickers) and all events (to find partnership
events). On a 2k-person tree that's a ~230KB person list + ~600KB event list per
view. Now it loads only what the page shows:

Frontend:
- The relationship & spouse pickers use the backend's fuzzy pg_trgm search
  (debounced, typo-tolerant) instead of substring-filtering a preloaded array —
  better search, and no need to preload every person. PersonCombobox gained an
  `onSearch` server mode (client `people` mode still works).
- The page drops the all-persons and all-events fetches; it resolves just this
  person's relatives' names via GET /persons?ids=..., and reads partnership
  events from the per-person events endpoint.

Backend:
- GET /trees/{id}/persons?ids=a,b,c — batch by id (privacy-filtered, names
  batched), for relative-name display.
- list_events_for_person (member path) now also returns the person's partnership
  events, so the page needn't scan every event in the tree.

Adversarial review (frontend logic + backend/privacy) found no issues. Suite 105
passing.

Signed-off-by: Justin Paul <justin@jpaul.me>
justin merged commit e7115023e1 into main 2026-06-11 08:29:33 -04:00
justin deleted branch person-page-server-search 2026-06-11 08:29:33 -04:00
Sign in to join this conversation.