Skip to content

fix: ignore route groups when generating typed routes - #14050

Merged
dummdidumm merged 5 commits into
mainfrom
typed-route-ids-fix
Jul 25, 2025
Merged

dummdidumm merged 5 commits into
mainfrom
typed-route-ids-fix

Conversation

@dummdidumm

Copy link
Copy Markdown
Member

Fixes #14043
Fixes #14044


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

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.

@changeset-bot

changeset-bot Bot commented Jul 25, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a05576

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

@dummdidumm
dummdidumm marked this pull request as draft July 25, 2025 11:12
@dummdidumm
dummdidumm marked this pull request as ready for review July 25, 2025 11:36
@Conduitry Conduitry changed the title fix: ignore route groupes when generating typed routes fix: ignore route groups when generating typed routes Jul 25, 2025
Comment thread .changeset/tidy-owls-enter.md Resolved
@dummdidumm
dummdidumm merged commit 1cd93cd into main Jul 25, 2025
@dummdidumm
dummdidumm deleted the typed-route-ids-fix branch July 25, 2025 13:59
@github-actions github-actions Bot mentioned this pull request Jul 25, 2025
Copilot AI pushed a commit to Stadly/kit that referenced this pull request Mar 6, 2026
teemingc added a commit that referenced this pull request Nov 18, 2026
…17808)

Fixes #17805

Since [#15458](#15458), `resolve()`
accepts route IDs followed by a query string or fragment. That type-only
change assumed the runtime already passed suffixes through correctly,
but `resolve_route` treated the entire input as route segments. A final
`(group)` therefore stopped matching the group predicate and remained in
the destination, producing a 404. Other suffix contents could also
undergo segment filtering, parameter replacement or escape expansion.

Separate the suffix at the first literal `?` or `#` in the shared
resolver, resolve only the route portion, and append the suffix
unchanged. Move the existing missing-params guard and parameter
defaulting there as well, so brackets inside query strings or fragments
do not trigger route-parameter diagnostics. Diagnostics still retain the
original input ID.

This preserves the group-free segment contract used by route parsing and
type generation from
[#14050](#14050), and the
single-pass parameter/escape expansion from
[#16570](#16570). Explicit
trailing-slash preservation from
[#14294](#14294) now inspects only
the route portion, with normalized roots retaining a single slash.
Widening the group regex instead would discard the suffix along with the
group and leave the other suffix transformations unresolved.

Both client and server resolution use this boundary without changing
base-path, request-relative or hash-router prefixing. Literal pathname
inputs still bypass route-ID processing; build-time callers continue
supplying their parameter objects.

- [Minimal SvelteLab
reproduction](https://www.sveltelab.dev/#code=N4IgzgTgxiBcoBMCWECmUAuB7CBPOoAhgA7EB0AFhgLYA2BIAZkrag1FgHYardhwgAPAEIEWTLmKoABFToA%2BADqdBc2tNqFOAcwC8ikLwNLOijKtSEEJs2cHVUGQtKgVCEMI-0gArhkYAtAAcBtIA9DYYdg5O0pyEDt4AbkioAO7EOFEgLlw83N5pSAgYFLoIqClQqAFFJRQANNJInEgYSIS0AWBQnai6AIyhEcq25jHO8YkGPAAeGN29rKEc3LwY3j19w5FmAKRgSai0PADWbZSWCHuj5mEUV5GCAEZYCLjSCIRO3UcnqOcFsQ0LQsFYAl8nN4KFgjhBjLc7MgktIwBhcKxvMgwMRNLhYLk1nxjAc-mcLq93ntBGFkU8wpTcCYaWoTCAAL7shogEjkBBkDD8eBMFhsYWrfKCgRhMLSADKqBkVAwxDAsBlh2OPDIFSStPEYDCgLC6KkYAAxLydQKwMoZdJGDhmpxHRBqN8kFxpIRXn5pKVUJ5nTwIIxCNVbZwKlBNGhpNpQc9OtJgLcpoHiOGZABBUgpxEYe0tENh6rSACiEAgTuA7ILRbWoaz0gAMuJOmAU3XTFFC7Li6gm2WAAqEbSoAAi32ctfr-cbpZko-HcqcPC7c%2BDg8X0mHmn8O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iyAABZQHyVPA%2BDGqdX5kAzlnIUBMNbVy1mhHihFvRfGwoOCS9FKH8MwdgrxEA8EENkq0Xi15%2BLoMBOJRgtFpB0T8f8ahbQwjXzCW4vixEKjME4KgAAwjbTOsT4l0XSZxc8l4%2BI5PwScT4qBckFKKdoX8yDpBcJ4Z7AkcdoltFaR4nBg4CSBJDJZDyedODsk8mraWQA)

<!--
svelte-triage-bot:feedback-baseline:d243d66890c122c246950c28f26c1dc952615c26
-->

---------

Co-authored-by: svelte-triage-bot <[email protected]>
Co-authored-by: Tee Ming <[email protected]>
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.

Skip (group)s in Pathname/resolve page.url.pathname types are wrong inside layout groups

3 participants