fix: required parameters placed after missing optional parameters are no longer skipped - #9331
Merged
Conversation
dummdidumm
reviewed
Mar 6, 2023
dummdidumm
left a comment
Member
There was a problem hiding this comment.
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)
Contributor
Author
|
Sure @dummdidumm ! Do you want me to keep the playwright test or replace it? |
Member
|
replace them |
… no longer skipped
benmccann
reviewed
Mar 6, 2023
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Rich-Harris
approved these changes
Mar 6, 2023
Member
|
Thank you! Happy the fix turned out to be so simple |
benmccann
reviewed
Mar 8, 2023
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| '@sveltejs/kit': fix | |||
Member
There was a problem hiding this comment.
fyi, this needed to be patch. releases are failing because this is an invalid value: #9365
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.