]> git.ipfire.org Git - thirdparty/vuejs/router.git/commit
fix: null should be preserved in relative navigations fix/optional-param-relative 2083/head
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 20 Jun 2023 15:52:04 +0000 (17:52 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 15 Dec 2023 14:15:25 +0000 (15:15 +0100)
commitc93e259e39a96117439aa02c351b625e780e4a90
treecc18e1f8c77cfe96c8ed0b5dceadac168c8f5215
parentb298d56db5e81fc1b94c639f4b34349fdecddda2
fix: null should be preserved in relative navigations

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
packages/router/__tests__/router.spec.ts
packages/router/src/encoding.ts
packages/router/src/utils/index.ts