Skip to content

[Bug Report][3.1.14] Components built with @/composables/router can crash when routes are missing required paramsΒ #17176

@MatthewAry

Description

@MatthewAry

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: vuejs/router#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: vuejs/router#845 (comment) 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 #17176 (comment)

Metadata

Metadata

Labels

T: bugFunctionality that does not work as intended/expectedframeworkIssues and Feature Requests that have needs framework-wide.help wantedWe are looking for community help

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions