Skip to content

Commit ab28070

Browse files
committed
Revert "fix(VBtn, VChip): correct link active state after navigation cancellation (#21651)"
This reverts commit bce7046. closes #22072 closes #22065
1 parent e69caa0 commit ab28070

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

packages/vuetify/src/components/VBtn/VBtn.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export const VBtn = genericComponent<VBtnSlots>()({
153153
: props.value
154154
})
155155

156-
async function onClick (e: MouseEvent) {
156+
function onClick (e: MouseEvent) {
157157
if (
158158
isDisabled.value ||
159159
(link.isLink.value && (
@@ -165,9 +165,8 @@ export const VBtn = genericComponent<VBtnSlots>()({
165165
))
166166
) return
167167

168-
if (await (link.navigateWithCheck?.(e) ?? true)) {
169-
group?.toggle()
170-
}
168+
link.navigate?.(e)
169+
group?.toggle()
171170
}
172171

173172
useSelectLink(link, group?.select)

packages/vuetify/src/components/VChip/VChip.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,13 @@ export const VChip = genericComponent<VChipSlots>()({
162162
})
163163
})
164164

165-
async function onClick (e: MouseEvent) {
165+
function onClick (e: MouseEvent) {
166166
emit('click', e)
167167

168168
if (!isClickable.value) return
169169

170-
if (await (link.navigateWithCheck?.(e) ?? true)) {
171-
group?.toggle()
172-
}
170+
link.navigate?.(e)
171+
group?.toggle()
173172
}
174173

175174
function onKeyDown (e: KeyboardEvent) {

packages/vuetify/src/composables/router.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
resolveDynamicComponent,
77
toRef,
88
} from 'vue'
9-
import { isNavigationFailure } from 'vue-router'
109
import { deepEqual, getCurrentInstance, hasEvent, IN_BROWSER, propsFactory } from '@/util'
1110

1211
// Types
@@ -48,7 +47,6 @@ export interface UseLink extends Omit<Partial<ReturnType<typeof _useLink>>, 'hre
4847
isClickable: Readonly<Ref<boolean>>
4948
href: Ref<string | undefined>
5049
linkProps: Record<string, string | undefined>
51-
navigateWithCheck?: (e: MouseEvent | undefined) => Promise<boolean>
5250
}
5351

5452
export function useLink (props: LinkProps & LinkListeners, attrs: SetupContext['attrs']): UseLink {
@@ -86,18 +84,12 @@ export function useLink (props: LinkProps & LinkListeners, attrs: SetupContext['
8684
})
8785
const href = computed(() => props.to ? link.value?.route.value.href : props.href)
8886

89-
async function navigateWithCheck (e: MouseEvent | undefined) {
90-
const result = await link.value?.navigate(e)
91-
return !isNavigationFailure(result)
92-
}
93-
9487
return {
9588
isLink,
9689
isClickable,
9790
isActive,
9891
route: link.value?.route,
9992
navigate: link.value?.navigate,
100-
navigateWithCheck,
10193
href,
10294
linkProps: reactive({
10395
href,

0 commit comments

Comments
 (0)