Skip to content
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: null should be preserved in relative navigations #2083

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

posva
Copy link
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

Copy link

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

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 67fee5f to c93e259 Compare December 15, 2023 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changed behaviour for optional params
1 participant