beadboard/tests/hooks
zenchantlive 4b8770c78c feat(hooks): complete bb-ui2.4 - URL State Hook
STORY:
The Unified UX needs URL as the single source of truth for view state.
This enables deep linking, bookmarking, and shareable URLs that
preserve exactly what the user was looking at.

COLLABORATION:
Created useUrlState hook using Next.js useSearchParams and useRouter:

Interface:
- view: 'social' | 'graph' | 'swarm' (default: social)
- taskId: selected task ID (for detail panel)
- swarmId: selected swarm ID
- panel: 'open' | 'closed' (detail panel state)
- graphTab: 'flow' | 'overview' (graph view mode)

URL Patterns:
- /?view=social
- /?view=social&task=bb-buff.1&panel=open
- /?view=swarm&swarm=bb-buff
- /?view=graph&task=bb-buff.1&graphTab=flow

The hook uses router.push for URL updates, ensuring no local state
drift from the URL source of truth.

DELIVERABLES:
- src/hooks/use-url-state.ts with parseUrlState, buildUrlParams, useUrlState
- tests/hooks/use-url-state.test.ts with 18+ tests

VERIFICATION:
- npm run typecheck: PASS
- npm run lint: PASS
- npm run test: PASS (all tests including new ones)

CLOSES: bb-ui2.4
BLOCKS: bb-ui2.5
2026-02-15 21:17:30 -08:00
..
use-beads-subscription.test.ts docs(beads): etch project history into memory bank and finalize skill-bb 2026-02-14 00:21:25 -08:00
use-url-state.test.ts feat(hooks): complete bb-ui2.4 - URL State Hook 2026-02-15 21:17:30 -08:00