wealth/docs/pages/market/not-found.md

30 lines
5.5 KiB
Markdown
Raw Normal View History

2026-10-21 09:16:11 +00:00
# Not-found and error
`apps/{bull,bear}/src/app/not-found.tsx`, `global-error.tsx`, and each route group's `error.tsx` · Layout: [layout.md](layout.md)
Every case below is `noindex`. No page answers 410, and the repo sets up no reverse proxy, so 503 under overload comes from whatever sits in front of the app's port.
| Case | Status | The server HTML holds |
| ----------------------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| A URL no route matches | 404 | the root `not-found.tsx`: `noindex` from its `metadata`, `StatusEmptyState` (not-found, page size) in the first flush; bull: the `MobileTopBar` behind a same-size frame; bear: the `DesktopHeader` behind one (both read the address in the browser) |
| `/@username/…` | 308 to `/channels/username/…` | nothing; `redirects()` in `next.config.ts` answers before any render (0064) |
| A channel or post that doesn't exist | 200 | `noindex` and the route's `loading.tsx` skeleton: both routes keep a `loading.tsx`, so `notFound()` runs after the status is sent; the channel's `not-found.tsx` renders in the browser. See [channels-username.md](channels-username.md) and [channels-username-posts-id.md](channels-username-posts-id.md) |
| `notFound()` on any other page, all under a `loading.tsx` | 200 | the skeleton and `noindex`; the not-found UI renders in the browser |
| A failed read on a page under its `loading.tsx` | 200 | the skeleton and the page's `noindex`; the group's `error.tsx` renders `PageError` in the browser, with its own `noindex` |
| A failed read on a page with no `loading.tsx` above it | 500 | `noindex` and an empty `<body>`; the group's `error.tsx` renders in the browser. No page is in this case today: every route keeps a `loading.tsx`. The channel and post pages join it once theirs goes (Notes) |
| An error the group boundaries don't catch (root layout, AppShell) | 500 | `global-error.tsx`: its own document with `AppCrash` and `<meta name="robots" content="noindex">`, rendered in the browser |
## Boundaries
| File | Renders |
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `(main)/error.tsx` | `PageError` with the page's own bar, derived from the path (0049); bull: `layout="mobile"`, the layout keeps the bottom nav; bear: `layout="desktop"` under the header |
| `(flow)`, `(auth)`, `(onboarding)` `error.tsx` | `PageError` with `standalone`, a full-height page with its own top bar (0049) |
| `(landing)/error.tsx` | `PageError` with `standalone` |
| `global-error.tsx` | `AppCrash`: the brand and the way back, in its own `<html>` with the client bootstrap, styles, and i18n |
## Notes
- `PageError` and `global-error.tsx` render `<meta name="robots" content="noindex">`; the root `not-found.tsx` sets it in `metadata`.
- Debt: the channel and post pages are indexable but keep a `loading.tsx`, so a missing channel or post answers 200 instead of a real 404. See those docs.