20 lines
1.8 KiB
Markdown
20 lines
1.8 KiB
Markdown
# 0023 The desktop composer is an intercepted dialog
|
||
|
||
Status: Proposed · Area: architecture · Date: 2026-10-07 · Decided by: agent
|
||
|
||
## Context
|
||
C4 ۷.۳ opens «پست جدید» on desktop as a 640px dialog over the page the creator is on, while /compose/post is also a page of its own (a reload, a shared link, a login that returns there). Mobile keeps the pushed page.
|
||
|
||
## Decision
|
||
- bear's `(main)` layout has a `@modal` slot. `@modal/(.)compose/post` intercepts a soft navigation to /compose/post and renders the composer in island `Modal size="wide"`; a hard load gets the `(flow)` full page. The edit route is not intercepted.
|
||
- The slot is emptied by explicit null pages for the routes the dialog lands on (`@modal/channels/[username]`), never by a catch-all: a catch-all would match every unbuilt path, and a soft navigation there keeps the old page under the new URL.
|
||
- `(main)/default.tsx` reloads the URL when the intercept fires from outside `(main)` (the full composer's header, a login that returns there), so the full page takes over instead of a dialog over an empty frame.
|
||
- Closing the dialog goes back in history. Publishing over the creator's own channel also goes back, then refreshes, so the channel isn't in history twice; anywhere else it replaces the dialog's entry with the channel and refreshes. The refresh is needed because the channel under the dialog is reused, not fetched again.
|
||
|
||
## Alternatives
|
||
- Dialog state without a route: rejected; the URL would not say what is open, and the composer's deep link would need a second code path.
|
||
- A `[...catchAll]` slot page: rejected for the reason above.
|
||
|
||
## Consequences
|
||
Every new route the dialog can land on needs its own null `@modal` page. While the dialog is open `usePathname()` reads /compose/post, so the page under it sees that path.
|