Skip to content

Commit

Permalink
fix(router): make props.to individually reactive
Browse files Browse the repository at this point in the history
fixes #19515
  • Loading branch information
johnleider committed Mar 30, 2024
1 parent 46eaff3 commit f15b57b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vuetify/src/composables/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ export function useLink (props: LinkProps & LinkListeners, attrs: SetupContext['
}
}
// vue-router useLink `to` prop needs to be reactive and useLink will crash if undefined
const linkProps = computed(() => ({ ...props, to: props.to ? props.to : {} }))
const linkProps = computed(() => ({
...props,
to: toRef(() => props.to || {}),
}))

const routerLink = RouterLink.useLink(linkProps.value as UseLinkOptions)
// Actual link needs to be undefined when to prop is not used
Expand Down

0 comments on commit f15b57b

Please sign in to comment.