Skip to content

fix: null should be preserved in relative navigations#2083

Draft
posva wants to merge 1 commit intomainfrom
fix/optional-param-relative
Draft

fix: null should be preserved in relative navigations#2083
posva wants to merge 1 commit intomainfrom
fix/optional-param-relative

Conversation

@posva
Copy link
Copy Markdown
Member

@posva posva commented Dec 15, 2023

The fix is a bit more complicated that I anticipated, I will come back to this later on as the currently documented version works perfectly.

  • the nullish params are removed before being passed to the matcher
  • The encodeParam function transform null into ''
  • The applyToParams also works with arrays but it makes no sense to allow null in array params

Ideally, I would make the matcher a bit more permissive so the encoding is kept at the router level. I think the matcher sholud be responsible for removing the nullish parameters but that also means the encode function should leave nullish values untouched. We might need an intermediate Type for this shape of Params, it gets a little bit tedious in terms of types, so I would like to avoid adding more types.

Close #1893

@netlify
Copy link
Copy Markdown

netlify Bot commented Dec 15, 2023

Deploy Preview for vue-router canceled.

Name Link
🔨 Latest commit c93e259
🔍 Latest deploy log https://app.netlify.com/sites/vue-router/deploys/657c61c42737a50008e91f69

@posva posva force-pushed the fix/optional-param-relative branch from 67fee5f to c93e259 Compare December 15, 2023 14:25
The fix is a bit more complicated that I anticipated, I will come back
to this later on as the currently documented version works perfectly.

- the nullish params are removed before being passed to the matcher
- The encodeParam function transform null into ''
- The applyToParams also works with arrays but it makes no sense to
  allow null in array params

Ideally, I would make the matcher a bit more permissive so the encoding
is kept at the router level. I think the matcher sholud be responsible
for removing the nullish parameters but that also means the encode
function should leave nullish values untouched. We might need an
intermediate Type for this shape of Params, it gets a little bit tedious
in terms of types, so I would like to avoid adding more types.

Close #1893
@posva posva force-pushed the fix/optional-param-relative branch from c93e259 to b1519f9 Compare April 22, 2026 14:39
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 22, 2026

Deploy Preview for vue-router canceled.

Name Link
🔨 Latest commit b1519f9
🔍 Latest deploy log https://app.netlify.com/projects/vue-router/deploys/69e8dd9f4c012e0008c8d18f

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 789196f8-f4ac-430b-8eb6-44fc4f2089c4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/optional-param-relative

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 22, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vue-router@2083

commit: b1519f9

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 22, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vue-router@2083

commit: b1519f9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📆 Planned

Development

Successfully merging this pull request may close these issues.

Changed behaviour for optional params

1 participant