Skip to content

breaking: exclude directories without a +page or +server from RouteId - #16580

Merged
elliott-with-the-longest-name-on-github merged 7 commits into
sveltejs:version-3from
Nic-Polumeyv:fix-routeid-union
Jul 30, 2026
Merged

breaking: exclude directories without a +page or +server from RouteId#16580
elliott-with-the-longest-name-on-github merged 7 commits into
sveltejs:version-3from
Nic-Polumeyv:fix-routeid-union

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

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.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Jul 30, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 3c9ef02:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/3c9ef02321988d78d10d352c8df83fd4c9677b00

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

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3c9ef02

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 Major

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

@Nic-Polumeyv
Nic-Polumeyv marked this pull request as draft July 30, 2026 02:35

@Rich-Harris Rich-Harris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, this makes sense. thank you!

@Rich-Harris

Copy link
Copy Markdown
Member

(it's still marked draft — is that intentional?)

@Nic-Polumeyv

Copy link
Copy Markdown
Contributor Author

I needed to review something I noticed last night, after I got some sleep. Will update in a couple min

@teemingc

teemingc commented Jul 30, 2026

Copy link
Copy Markdown
Member

Sorry, I thought this solved a different issue but #16588 might have solved the same issue. The type tests look like they're worth carrying over though (if the one I opened even works)

EDIT: the type stuff might solve something different though?

@Nic-Polumeyv

Nic-Polumeyv commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

No worries! Yeah, layout-only directories survive #16588's filter, so they still land in RouteId. Trimmed this down to the types half.

@Nic-Polumeyv
Nic-Polumeyv marked this pull request as ready for review July 30, 2026 18:17
Rich-Harris pushed a commit that referenced this pull request Jul 30, 2026
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:
- [x] 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
- [x] This message body should clearly illustrate what problems it
solves.
- [x] 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.
@elliott-with-the-longest-name-on-github
elliott-with-the-longest-name-on-github merged commit d8617b3 into sveltejs:version-3 Jul 30, 2026
39 of 41 checks passed
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.

resolve allows non-existing routes ($app/paths)

4 participants