Open popapaul opened 12 months ago
I've also encountered this issue in my project that's using "@sveltejs/kit": "^2.0.0""
and "svelte": "^4.2.7""
.
[!NOTE] This issue only persists if the Level 1 route (
lang
param) is optional. If it's a required level route, then the problem goes away. Alternatively it also works whenlang
route is optional, but when instead of[explore=explore]
we use hardcoded value for this route level.
My structure looks like this:
[[lang=lang]]/
[explore=explore]/
+page.server.js
[offer_type=offer_type]/
[[city=city]]/
[[district=district]]/
[[subdistrict=subdistrict]]/
+page.server.js
[view_mode=view_mode]/
+page.svelte
Routes that are working:
/en/explore/sale/map
— here city
, district
and subdistrict
params are not present/en/explore/sale/warszawa/srodmiescie/powisle/map
— here all 3 optional parameters are presentRoutes that are returning 404:
/en/explore/sale/warszawa/map
— here we are missing district
and subdistrict
optional params/en/explore/sale/warszawa/srodmiescie/map
— here we are just missing subdistrict
optional param[lang=lang]/
[explore=explore]/
+page.server.js
[offer_type=offer_type]/
[[city=city]]/
[[district=district]]/
[[subdistrict=subdistrict]]/
+page.server.js
[view_mode=view_mode]/
+page.svelte
[[lang=lang]]/
explore/
+page.server.js
[offer_type=offer_type]/
[[city=city]]/
[[district=district]]/
[[subdistrict=subdistrict]]/
+page.server.js
[view_mode=view_mode]/
+page.svelte
Describe the bug
In case of the following route structure:
The following links will go correctly to Program route:
But /2022/program ✘ will instead go to Content route, practically turning the optional parameter culture into a required parameter when year is set which is not in my opinion the expected behaviour
Content route as rest parameter:
Expected behaviour:
Actual behaviour:
Additionally
When changing /[[culture=culture]]/[[year=year]]/[...content] to /[[culture=culture]]/[[year=year]]/[content],
The following links will go correctly to Content route:
But
will both be met by 404 Not Found.
Expected behaviour:
/2022/program -> Program route /2022/content -> Content route
Actual behaviour:
/2022/program -> 404 /2022/content -> 404
Reproduction
Stackblitz Reproduction
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response