Skip to content

Commit

Permalink
refactor(VCombobox): remove ref reactivity from cleared let
Browse files Browse the repository at this point in the history
  • Loading branch information
johnleider committed Mar 22, 2023
1 parent ac29f7a commit 6344ed4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vuetify/src/components/VCombobox/VCombobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const VCombobox = genericComponent<new <
},
})
const selectionIndex = ref(-1)
const cleared = ref(false)
let cleared = false
const color = computed(() => vTextFieldRef.value?.color)
const { items, transformIn, transformOut } = useItems(props)
const { textColorClasses, textColorStyles } = useTextColor(color)
Expand Down Expand Up @@ -162,11 +162,11 @@ export const VCombobox = genericComponent<new <
},
})
watch(_search, value => {
if (cleared.value) {
if (cleared) {
// Implement open-on-clear (https://github.com/vuetifyjs/vuetify/issues/16925)
// wait for clear to finish, VTextField sets _search to null
// then search computed triggers and updates _search to ''
nextTick(() => (cleared.value = false))
nextTick(() => (cleared = false))
} else if (isFocused.value && !menu.value) {
menu.value = true
}
Expand Down Expand Up @@ -199,7 +199,7 @@ export const VCombobox = genericComponent<new <
const listRef = ref<VList>()

function onClear (e: MouseEvent) {
cleared.value = true
cleared = true

if (props.openOnClear) {
menu.value = true
Expand Down

0 comments on commit 6344ed4

Please sign in to comment.