routing
/routing
Opisuje konwencje routingu w aplikacjach Esposter w apps/web: linki, nawigację, odczyt parametrów trasy, stan nawigacji i segmenty dynamiczne.
- Autor
- Esposter ↗
- Repozytorium
- Esposter ↗
- Licencja
- Apache-2.0
- Ostatnia zmiana repozytorium
- 26.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 7
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
Co robi i kiedy
Opisuje konwencje routingu w aplikacjach Esposter w apps/web: linki, nawigację, odczyt parametrów trasy, stan nawigacji i segmenty dynamiczne.
Oryginalny opis (EN)
Apply when adding links, navigating in code, reading route params/query, syncing tabs to the URL, or writing pages with dynamic or optional route segments. Esposter's routing — how links, navigation, route reads, navigation state and dynamic segments are written in apps/web.
Jak działa
- Links — NuxtLink / NuxtInvisibleLink or :to, Never a Raw <a>
- Imperative Navigation — navigateTo
- Route Reads — a Page's Own useRoute(), useRouter().currentRoute Everywhere Else
- Where Navigation State Lives — references/navigation-state.md
- Route-Synced Tabs — references/route-synced-tabs.md
- Optional / Nested Segments — references/nested-segments.md
- Static Paths — Never a Page's
- Deep Dives
Podgląd SKILL.md
---
name: routing
description: Apply when adding links, navigating in code, reading route params/query, syncing tabs to the URL, or writing pages with dynamic or optional route segments. Esposter's routing — how links, navigation, route reads, navigation state and dynamic segments are written in apps/web.
---
# Routing
## Links — `NuxtLink` / `NuxtInvisibleLink` or `:to`, Never a Raw `<a>`
A link is `NuxtLink`, `NuxtInvisibleLink` or a library component's `:to`, never a raw `<a>` (`vue/no-restricted-html-elements`), with its target from `RoutePath` (`references/links.md`). A route is `RoutePath`'s wherever it is written, a test's address or a template string as much as a link, so a rename moves every reader; `routing/no-route-literal` (`scripts/src/oxlint/routing.ts`) reports a string spelling one of its paths, read off `RoutePath` itself.
## Imperative Navigation — `navigateTo`
`navigateTo(target, options)`, always awaited or returned — never `router.push` (`vue/no-restricted-syntax`); a single-expression inline handler already returns it (`references/navigate-to.md`).
## Route Reads — a Page's Own `useRoute()`, `useRouter().currentRoute` Everywhere Else
**A page reads its own segments through `useRoute()`** — the one place the call is allowed, and a page's only route read, since a page navigates with `navigateTo`; the page override in `oxlint.config.ts` enforces it. The typed router narrows a page's no-argument `useRoute()` to that page's params, so `route.params.id` is a `string` with no helper and no cast:
```ts
const route = useRoute();
const { id } = route.params;
```
**Everywhere else `useRoute()` is banned** — a component, composable or store reads `useRouter().currentRoute`, destructured, because a ref reached through `router.` does not auto-unwrap in a template while `currentRoute` does.
- **Outside a page, a segment is read by name — `getRouteParam(params, name)`** — never a property access or an `as string` cast. Params read without naming the route are the union of every page's, so a property access does not typecheck, and the name is checked against the route map instead; a route without the segment answers `""`. A `definePageMeta` callback's `route` is that union too, so it takes `getRouteParam`. The room a message surface reads for is the room store's `currentRoomId`, never a fresh route read. A query value goes through `getRouteParamString`.
- **A page hands its segment down** rather than a composable re-reading the route: `useReadUser(route.params.id)`, never a `*FromRoute` composable.
- **Guard before spending a request** (`checkIsUuidV4(id)`) where a read can race a navigation — it resolves the route after the user has left the page that named it, and the lint rule cannot see that.
- Why the ban holds outside pages, the `definePageMeta` callbacks that are not a `useRoute()` call, and the one component test that may `mockNuxtImport("useRoute")`: `references/route-reads.md`.
## Where Navigation State Lives — `references/navigation-state.md`
Decide by what the value **is**: part of what the page shows (a filter, a page number, a tab) → the **URL**; how the visitor got here (a breadcrumb trail, a drill-down) → the **history entry**, written in one `router.afterEach` hook and never at each link; what the visitor prefers → **`localStorage`** through the `LocalStorageKey` registry. The history-entry mechanics, and why nothing reactive may enter it, are in `references/navigation-state.md`.
## Route-Synced Tabs — `references/route-synced-tabs.md`
`UiTabs` state syncs to the URL through `useEnumRouteQuery(TAB_QUERY_PARAMETER_KEY, FooTabs, FooTab.Default)`, never a plain `ref`, so the active tab survives a refresh and is linkable; each enum exposes its value `Set` beside it.
## Optional / Nested Segments — `references/nested-segments.md`
One page serving optional or nested segments is keyed by the stable segment only and validates its params in `definePageMeta({ validate })`; the stable segment is read once off the page's `useRoute()`, the changing one through a `computed`, and what `validate` cannot know before load is checked after it with `showError`.
## Static Paths — Never a Page's
A file in `public/` or a Nitro `publicAssets` mount never sits at a path a page answers: the server serves the static path first, so the page works when linked to and breaks on a reload (a directory redirects to its trailing-slash form, which no page matches). Mount asset data under a prefix no page uses, as `data/<feature>/` does; `configuration/nitro.test.ts` resolves every static path through the router and fails on a match.
## Deep Dives
- `references/route-reads.md` — when the `useRoute()` ban fires outside a page, or a component test must drive the route.
- `references/navigation-state.md` — when deciding where a filter, tab, trail or preference is kept, or writing into a history entry.
- `references/route-synced-tabs.md` — when a tab or enum-valued selector should survive a refresh.
- `references/nested-segments.md` — when one page component serves optional or nested segments.
- `references/links.md` — when adding a link or a control that goes somewhere.
- `references/navigate-to.md` — when code navigates imperatively.
Pliki w paczce (7)
- SKILL.md 5 KB
- references/links.md 1 KB
- references/navigate-to.md 1 KB
- references/navigation-state.md 2 KB
- references/nested-segments.md 4 KB
- references/route-reads.md 2 KB
- references/route-synced-tabs.md 1 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · Esposter/Esposter | 100 | Apache-2.0 |
| cm208/p0ssess | 100 | MIT |
| larcane97/clausona | 100 | MIT |
| thomaslangbroek/frugal | 100 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 90e13c83d513 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100rn-expo-router
Pomaga w nawigacji w aplikacji Expo i React Native: trasy, układy tab, stack i drawer, modale, segmenty dynamiczne, typowane trasy, deep linking i parametry wyszukiwania. - 100nextjs-routing
Obsługuje routing w Next.js App Router: trasy plikowe, segmenty dynamiczne, grupy tras, trasy równoległe i przechwytujące, middleware, nawigację programową i linki. - 100vue-routing
Konfiguruje Vue Router v4: trasy zagnieżdżone, parametry, strażników nawigacji, leniwe ładowanie i programową nawigację. - 100flutter-navigation
Implementuje, naprawia i weryfikuje nawigację i routing Flutter: Navigator, Router API, go_router, strażnicy tras, ShellRoute, deep linki, App Links, Universal Links, URL w web i testy tras. - 100flutter-implementing-navigation-and-routing
Obsługuje routing, nawigację i deep linki w aplikacji Flutter, przy przechodzeniu między ekranami i nawigacji opartej na URL. - 90flutter-core:flutter-navigation-routing
Projektuje nawigację i routing we Flutterze: deklaratywne trasy, GoRouter, linki głębokie, strażników tras i złożone przepływy.