Skip to content

fix: exclude routes without a page/endpoint from routes - #16588

Merged
Rich-Harris merged 5 commits into
version-3from
fix-routes-data
Jul 30, 2026
Merged

fix: exclude routes without a page/endpoint from routes#16588
Rich-Harris merged 5 commits into
version-3from
fix-routes-data

Conversation

@teemingc

@teemingc teemingc commented Jul 30, 2026

Copy link
Copy Markdown
Member

alternative to #16580
closes #5793

We already implemented the feature but it has the bug mentioned in that issue. This PR removes route data for directories with no route files and items in routes that would likely return a 404 (no page, no endpoint, etc.).

Some additional fixes are that LayoutParams only includes paths with layout files. Also, the route data gets considerably smaller for larger projects.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Jul 30, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 4b84425:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/4b84425dcef67d4127ae25fb9fc1c182755d8ec0

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16588

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4b84425

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot

Copy link
Copy Markdown

@Rich-Harris

Copy link
Copy Markdown
Member

Oh I just hit approve on #16580 — does this supersede that PR?

@teemingc

teemingc commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

Ah yeah, it solves as much as possible at the manifest_data.routes level rather than at the types/route generation themselves. Might have some unintended issues though if we needed those route data objects that had no route files attached to them. The extra tests in that PR might still be useful though

@Nic-Polumeyv

Copy link
Copy Markdown
Contributor

I was actually working on this exact other half last night lol. Thats why its on draft. Seems like we could have both PR's?

Nic-Polumeyv added a commit to Nic-Polumeyv/kit that referenced this pull request Jul 30, 2026
@Rich-Harris
Rich-Harris merged commit fe9d8d9 into version-3 Jul 30, 2026
25 checks passed
@Rich-Harris
Rich-Harris deleted the fix-routes-data branch July 30, 2026 18:29
elliott-with-the-longest-name-on-github added a commit that referenced this pull request Jul 30, 2026
…uteId` (#16580)

Closes #14847. #15027 fixed the `Path` half of that issue; the `RouteId`
union still lists every directory, so `resolve('/a')` type-checks when
`/a` only holds child routes.

`LayoutParams` now keys off the generated layout map instead of
`RouteId`, and a layout sitting in a directory that isn't a route stops
claiming its own id in `LayoutRouteId`.

`resolve('/')` stops type-checking in an app whose root page lives in a
group, since `/(app)` is the route that serves `/`. Write `resolve('')`
instead.

#16588 covers the `$app/manifest` side. Also points #16588's `routes`
filter at `is_app_route` so the two stay in sync, and rewords its
changeset to cover the #5793 fix.

---------

Co-authored-by: Elliott Johnson <hello@ell.iott.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Programmatically get all routes

3 participants