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

useRouteParams not using default value for empty optional params #3933

Closed
7 tasks done
TheVaan opened this issue Apr 22, 2024 · 0 comments · Fixed by #3934
Closed
7 tasks done

useRouteParams not using default value for empty optional params #3933

TheVaan opened this issue Apr 22, 2024 · 0 comments · Fixed by #3934

Comments

@TheVaan
Copy link

TheVaan commented Apr 22, 2024

Describe the bug

An optional param is resolved as an empty string not as undefined. Because of this, userRouteParams('param', 'default') won't return default but an empty string.

Setting a default value if param is missing is useless, when optional parameters are always empty string.

Reproduction

https://stackblitz.com/edit/vitejs-vite-157rjb

System Info

System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 123.70 MB / 32.00 GB
    Shell: 3.7.0 - /opt/homebrew/bin/fish
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    npm: 10.5.2 - ~/.nvm/versions/node/v20.11.1/bin/npm
  Browsers:
    Chrome: 124.0.6367.61
    Edge: 124.0.2478.51
    Firefox: 124.0.2
    Safari: 17.4.1

Used Package Manager

npm

Validations

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 a pull request may close this issue.

1 participant