-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix: required parameters placed after missing optional parameters are no longer skipped #9331
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Can you turn this into a unit test? I believe you can get the same outcome if you test that the route in question is not matched (by setting expected: undefined
)
Sure @dummdidumm ! Do you want me to keep the playwright test or replace it? |
replace them |
… no longer skipped
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Thank you! Happy the fix turned out to be so simple |
@@ -0,0 +1,5 @@ | |||
--- | |||
'@sveltejs/kit': fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi, this needed to be patch
. releases are failing because this is an invalid value: #9365
Due to multiple matching routes, exec is called for [[param1=required]]/[param2=param2]/[param3] even though we’ve provided 3 parameters which should correlate to the /[param2=param2]/[param3]/[param4] route.
The code flow was finishing with a buffer size of 0, which was incorrectly telling Kit that the route was a match. As such it wasn't attempting to parse other routes to check for a match, despite the fact there was still a required parameter that hadn't been matched.
This situation doesn’t appear to be covered under current unit tests as the tests load one route at a time. I've added a new Playwright test to cover this scenario.
Fixes #9304
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.