fix(search): error when not selected
This commit is contained in:
parent
b30ebc12f8
commit
4ca2053bb2
|
@ -36,16 +36,18 @@ watch([results, focused], () => index.value = -1)
|
||||||
const shift = (delta: number) => index.value = (index.value + delta % results.value.length + results.value.length) % results.value.length
|
const shift = (delta: number) => index.value = (index.value + delta % results.value.length + results.value.length) % results.value.length
|
||||||
|
|
||||||
const activate = () => {
|
const activate = () => {
|
||||||
(document.activeElement as HTMLElement).blur()
|
|
||||||
const currentIndex = index.value
|
const currentIndex = index.value
|
||||||
index.value = -1
|
index.value = -1
|
||||||
|
|
||||||
if (query.value.length === 0)
|
if (query.value.length === 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
(document.activeElement as HTMLElement).blur()
|
||||||
|
|
||||||
// Disable until search page is implemented
|
// Disable until search page is implemented
|
||||||
// if (currentIndex === -1)
|
if (currentIndex === -1)
|
||||||
// router.push(`/search?q=${query.value}`)
|
// router.push(`/search?q=${query.value}`)
|
||||||
|
return
|
||||||
|
|
||||||
router.push(results.value[currentIndex].to)
|
router.push(results.value[currentIndex].to)
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,9 +57,7 @@ export function useSearch(query: MaybeRef<string>, options?: UseSearchOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => unref(query), () => {
|
watch(() => unref(query), () => {
|
||||||
if (!unref(query) || !isMastoInitialised.value)
|
loading.value = !!(unref(query) && isMastoInitialised.value)
|
||||||
return
|
|
||||||
loading.value = true
|
|
||||||
})
|
})
|
||||||
|
|
||||||
debouncedWatch(() => unref(query), async () => {
|
debouncedWatch(() => unref(query), async () => {
|
||||||
|
|
Loading…
Reference in a new issue