[Bug Report][3.1.14] Components built with @/composables/router can crash when routes are missing required params
@MatthewAry is already working on this.
Since Jun 3, 2024.
- Dominant language
- TypeScript
- Stars
- 41k
- Forks
- 7.1k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 11
Description
Environment
Vuetify Version: 3.1.14
Vue Version: 3.2.47
Browsers: Chrome 112.0.0.0
OS: Mac OS 10.15.7
Steps to reproduce
This is a really dirty reproduction. Clone, and npm i and run.
There are two buttons, click on "VBtn Flaw" and then click on the home button in the top right corner.
Expected Behavior
Click on "Router Link" and then click on the home button on the top right corner. And see the expected behavior.
I expect that when you use a named route which is a child to a parent(s) with param(s) that it will inherit the params implicitly from it's parent, you shouldn't need to declare the params that are missing.
Actual Behavior
VBtn in the example crashes when you navigate back to home.
Reproduction Link
https://github.com/MatthewAry/vuetify-route-link-bug
Other comments
This reproduction shows the behavior with RouterLink and with VBtn the to params on the elements shown on those pages are basically the same. I think behaviorally when it comes to routing, there should be no difference between RouterLink and VBtn or any other component that uses @/composables/router
Update: https://github.com/vuejs/router/issues/845 has to do with this exact problem however the issue was closed because the team believed it was resolved. If you build your application in production mode you won't see this issue. See: https://github.com/vuejs/router/issues/845#issuecomment-806762085 Which suggests that this issue may be upstream or that the useLink method in @/composables/router needs to change in some manner to be more similar to what the RouterLink component is doing to avoid this issue. 🤷
Update: See https://github.com/vuetifyjs/vuetify/issues/17176#issuecomment-1517843304
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.