Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second non-optional parameter is skipped when root optional parameter is not matched #9304

Closed
banDeveloper opened this issue Mar 3, 2023 · 1 comment · Fixed by #9331
Closed
Labels
bug Something isn't working ready to implement please submit PRs for these issues!
Milestone

Comments

@banDeveloper
Copy link

Describe the bug

Considering the following route path:

/[[lang=en]]/[param1=param1]/[param2]/[param3]

  • lang matches "en"
  • param1 matches "a"

If we print out the params for each route we get:
/en/a - lang: "en", param1: "a" - correct
/en/a/b - lang: "en", param1: "a", param2: "b" - correct
/en/a/b/c - lang: "en", param1: "a", param2: "b", param3: "c" - correct

/a - param1: "a" - correct
/a/b - param1: "a", param2: "b" - correct
/a/b/c - param1: "a", param2: "c" - wrong, param2 should be b and param3 should be c

This bug did not exist in 1.3.8, I'm assuming it was caused by fix: successive optional route parameters can now be empty.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-p8azya?file=README.md

Logs

No response

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (6) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.0.0 
    @sveltejs/kit: ^1.5.0 => 1.9.3 
    svelte: ^3.54.0 => 3.55.1 
    vite: ^4.0.0 => 4.1.4

Severity

blocking an upgrade

Additional Information

No response

@Rich-Harris
Copy link
Member

Ah, whoops — cc'ing @glennsayers in case we don't get a chance to look at this soon :)

@dummdidumm dummdidumm added bug Something isn't working ready to implement please submit PRs for these issues! labels Mar 3, 2023
@dummdidumm dummdidumm added this to the soon milestone Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready to implement please submit PRs for these issues!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants