# Join before navigate — handoff

## Summary

When a user opens a room link for a room they have not joined, this preview page shows room info (name, topic, member count) and offers join before entering the timeline.

## User-facing behavior

- matrix.to / internal join links land here if not member
- Room card preview with topic
- Join button → membership then navigate to room/space
- Back navigation on mobile

## Architecture

```
JoinBeforeNavigate.tsx
  → RoomSummaryLoader for preview data
  → useRoomNavigate after join
Route: _JOIN_PATH in Router.tsx
```

## Key files

| Path | Role |
|------|------|
| `cinny/src/app/features/join-before-navigate/JoinBeforeNavigate.tsx` | Preview + join UI |
| `cinny/src/app/components/RoomSummaryLoader.tsx` | Fetch room preview |
| `cinny/src/app/hooks/useRoomNavigate.ts` | Post-join navigation |
| `cinny/src/app/state/joiningProgress.ts` | Join in progress UX |

## Data model

Preview from `/summary` API or peek room state. No local persistence.

## Dependencies

- matrix-js-sdk `joinRoom`
- `via` servers param for federated joins

## Integration points

- **routing-and-navigation**: join route with `roomIdOrAlias`, `viaServers`
- **explore**: similar preview patterns
- **electron-shell**: `paarrot://` deep links may target join flow

## Testing

### Manual

1. Open link to unjoined public room.
2. Preview shows name/topic.
3. Join succeeds; lands in timeline.
4. Space link navigates to space not room.

### Automated

- None

## Known issues & gotchas

- Private rooms without peek show limited preview
- `viaServers` required for some federated aliases
- `isSpace` check routes to space navigation after join

## Future work

- Knock rooms support
- Invite-only room messaging

## Related docs

- [routing-and-navigation HANDOFF](../routing-and-navigation/HANDOFF.md)
- [electron-shell HANDOFF](../electron-shell/HANDOFF.md)

## Add your extra things here

- Props: `roomIdOrAlias`, optional `eventId`, `viaServers[]`
