Skip to content

ui: navigate through resolve() with typed route ids - #73

Draft
allozaur wants to merge 1 commit into
allozaur/feat/prompt-libraryfrom
allozaur/refactor/ui-typed-routes
Draft

allozaur wants to merge 1 commit into
allozaur/feat/prompt-libraryfrom
allozaur/refactor/ui-typed-routes

Conversation

@allozaur

@allozaur allozaur commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Overview

Llama Chat navigates through SvelteKit 3's typed routes: every link and every goto() names a route that TypeScript checks exists, and the lint rule that enforces it is on again. Nothing changes for the user; the URLs are the same #/… ones.

Additional information

Part 10 of 13 of the work-in-progress stack on the fork, under the import costs (#74) and Pele (#75), based on allozaur/feat/prompt-library (#29). It comes last on purpose: projects, servers, the library and the extension pages all add routes, so one pass over the finished app touches every route once, where doing it in the SvelteKit 3 layer (#70) would have conflicted with each layer that adds one.

What changed
  • ROUTES holds route ids, as page.route.id reports them ('/models', '/(chat)/chat/[id]', '/[extensionPage]', …), checked against the app's routes with satisfies Record<string, RouteId>. The separate MODELS_ROUTE_ID, PROJECTS_ROUTE_ID, SERVERS_ROUTE_ID, SETTINGS_ROUTE_ID and EXTENSION_PAGE_ROUTE_ID constants fold into it.
  • Links and goto() calls go through resolve() from $app/paths, which returns #/models with the hash router. RouterService resolves the routes that take params: a chat, a project, a project's chat or new chat, and an extension's page.
  • Tab links, sidebar items and the extensions' navigation items carry ResolvedPathname, so a raw string no longer type-checks there. The MCP extension builds its page's URL with RouterService.extensionPage().
  • Checks for the current page compare page.route.id instead of searching the hash.
  • svelte/no-navigation-without-resolve is on again. The app's own modules get type information in ESLint, so a value typed as ResolvedPathname passes. Links that leave the app say so with rel="external"; the four deep-link cleanups, which change the current page's own query, carry a comment saying so.
  • Tests and stories build their fixture URLs with RouterService and resolve().
Testing
  • ui/apps/chat: npm ci, npm run check (0 errors), npm run lint, the 1062 unit tests, the 379 client tests, the Storybook tests (115 files) and npm run build pass.
  • In a browser on the build: the sidebar's Library link is #/library, New chat navigates to #/, the Models page opens at #/models; no console errors.
  • resolve() only adds the # in the browser: the server build of $app/paths returns /models. Nothing evaluates a route at module scope on the server here, and the client tests check the #/… URLs.

Requirements

@allozaur
allozaur added this pull request to stack #72 November 16, 2026 18:58
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from b689429 to 416c8f4 Compare November 17, 2026 05:21
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 416c8f4 to 92a5da0 Compare November 17, 2026 05:55
allozaur added a commit that referenced this pull request Nov 17, 2026
develop now holds the fork's stack as it is after the SvelteKit 3 upgrade:
the top of stack ggml-org#72 (#73, typed routes, on master with the move merged),
with the side branches merged in: MCP OAuth (#63), the models manager
(#38) and UI server storage (#39).

The merge takes the stack's files throughout. What develop carried beyond
the stack is left out for now: the mention drawer on phones (#49), the
Notebook page (#57), drag-and-drop import (#56), MCP resources in the @
picker (#19), the server's ASR transcription fixes and the reasoning level
shown as a word on the model selector. They were built on the stack before
SvelteKit 3 and stay in their own PRs and in develop's history.

Assisted-by: Claude (Opus 5.5 Medium)
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 92a5da0 to 94263f3 Compare November 17, 2026 06:43
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 94263f3 to 1595cd4 Compare November 17, 2026 07:00
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 1595cd4 to 76d59f1 Compare November 17, 2026 10:31
@allozaur
allozaur removed this pull request from stack #72 November 17, 2026 11:15
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 76d59f1 to e84ddbb Compare November 17, 2026 11:16
@allozaur
allozaur added this pull request to stack #76 November 17, 2026 11:16
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch 2 times, most recently from 3f58f8a to a225717 Compare November 17, 2026 12:27
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch 2 times, most recently from a17d8ea to fdd5722 Compare November 17, 2026 13:05
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from fdd5722 to 34d1507 Compare November 17, 2026 13:13
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch 2 times, most recently from 2e09f9c to b560132 Compare November 17, 2026 13:26
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from b560132 to d289d62 Compare November 17, 2026 13:44
@allozaur
allozaur removed this pull request from stack #76 November 17, 2026 13:44
@allozaur
allozaur added this pull request to stack #78 November 17, 2026 13:44
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from d289d62 to 901e6b6 Compare November 17, 2026 15:28
@allozaur
allozaur removed this pull request from stack #78 November 17, 2026 16:25
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 901e6b6 to 1a1424c Compare November 17, 2026 16:26
@allozaur
allozaur added this pull request to stack #79 November 17, 2026 16:26
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 1a1424c to ac3f857 Compare November 17, 2026 16:42
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch 2 times, most recently from ed9e1b4 to 90e4f82 Compare November 17, 2026 17:20
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 90e4f82 to 76b3bee Compare November 17, 2026 17:30
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 76b3bee to 97a409d Compare November 17, 2026 22:00
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 97a409d to 4517566 Compare November 17, 2026 22:21
ROUTES holds the app's route ids, as page.route.id reports them, in
place of hash strings and the separate *_ROUTE_ID constants. Every link
and goto() goes through resolve() from $app/paths, which checks the
route exists and returns its URL (#/models with the hash router).
RouterService resolves the routes that take params: a chat, a project,
a project's chat or new chat, and an extension's page. Tab links,
sidebar items and extension navigation items carry the resolved URL's
type, and checks for the current page compare page.route.id instead of
the hash.

svelte/no-navigation-without-resolve is on again, with type information
for the app's modules so a URL typed as ResolvedPathname passes. Links
that leave the app say so with rel="external"; the deep-link cleanups,
which change the current page's own query, are marked as such.

Assisted-by: Claude (Opus 5.5 Medium)
@allozaur
allozaur force-pushed the allozaur/refactor/ui-typed-routes branch from 4517566 to fee8780 Compare November 17, 2026 22:35

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant