30 lines
5.5 KiB
Markdown
30 lines
5.5 KiB
Markdown
# 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 page's skeleton: the server reads nothing (0070), so the browser's read finds the channel or post missing and renders `ChannelMissing` or `PostMissing` in the page's frame. 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 browser read of a page's data | 200 | the skeleton and the page's `noindex`; the read throws to the group's `error.tsx`, which renders `PageError` 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. Only the landing reads data on the server, and it is prerendered (0026): a failed revalidation keeps the last good page |
|
|
| 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`.
|
|
- A missing channel or post answers 200 by design: both pages are `noindex` and read in the browser (0070).
|