-
-
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: prerender optional parameters as empty when entries
contains '*'
#11178
fix: prerender optional parameters as empty when entries
contains '*'
#11178
Conversation
🦋 Changeset detectedLatest commit: 37cfe14 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Thanks for this! The description of I feel that creating a whole new test project is a bit overkill. It'd probably be better to refactor out a method that can be unit tested or add an optional route to an existing test project |
Will do! |
Co-authored-by: Ben McCann <[email protected]>
Co-authored-by: Ben McCann <[email protected]>
…ot' into 11133-crawl-optional-param-at-root
entries
contains '*'
Closes #11133
Currently, any routes with parameters are only prerendered if they are discovered through crawling, or export
entries
.This makes sense for required parameters, since it's not possible to know which values they accept otherwise.
For optional parameters, we do know that not passing a value is valid. With this PR routes with optional parameters that are marked as prerenderable will be crawled with no value by default.
Examples:
/some-route/[[optionalParam]]/a
will be crawled with/some-route/a
/some-route/[[optionalParam]]/a/[[optionalParam2]]/b
will be crawled with/some-route/a/b
A common situation where this causes frustration is on multi-langauge pages with a
[[lang]]
parameter at the root. In that case/
won't be crawled. It needs to be manually specified in the entries, which feels silly.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:
.