1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-05 00:19:59 +00:00

refactor: improve search UX

This commit is contained in:
三咲智子 2023-01-07 22:59:57 +08:00
parent 2b5badf235
commit 0bf76fdf86
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E

View file

@ -56,6 +56,12 @@ export function useSearch(query: MaybeRef<string>, options?: UseSearchOptions) {
}))]
}
watch(() => unref(query), () => {
if (!unref(query) || !isMastoInitialised.value)
return
loading.value = true
})
debouncedWatch(() => unref(query), async () => {
if (!unref(query) || !isMastoInitialised.value)
return
@ -78,7 +84,7 @@ export function useSearch(query: MaybeRef<string>, options?: UseSearchOptions) {
appendResults(nextResults.value, true)
loading.value = false
}, { debounce: 500 })
}, { debounce: 300 })
const next = async () => {
if (!unref(query) || !isMastoInitialised.value || !paginator)