Replaced .then() with await
This commit is contained in:
@@ -92,11 +92,10 @@ function moveIndex(dir: 1 | -1): void {
|
|||||||
scrollIntoView()
|
scrollIntoView()
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollIntoView(): void {
|
async function scrollIntoView(): Promise<void> {
|
||||||
tick().then(() => {
|
await tick()
|
||||||
const elem = document.querySelector(`[data-result-id="${selectedIndex}"]`)
|
const elem = document.querySelector(`[data-result-id="${selectedIndex}"]`)
|
||||||
elem?.scrollIntoView({ behavior: "auto", block: "nearest" })
|
elem?.scrollIntoView({ behavior: "auto", block: "nearest" })
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openSelection(): Promise<void> {
|
async function openSelection(): Promise<void> {
|
||||||
|
|||||||
@@ -78,15 +78,14 @@ function moveIndex(dir: 1 | -1): void {
|
|||||||
scrollIntoView()
|
scrollIntoView()
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollIntoView(): void {
|
async function scrollIntoView(): Promise<void> {
|
||||||
tick().then(() => {
|
await tick()
|
||||||
if (selectedNote) {
|
if (selectedNote) {
|
||||||
const elem = document.querySelector(
|
const elem = document.querySelector(
|
||||||
`[data-result-id="${selectedNote.path}"]`
|
`[data-result-id="${selectedNote.path}"]`
|
||||||
)
|
)
|
||||||
elem?.scrollIntoView({ behavior: "auto", block: "nearest" })
|
elem?.scrollIntoView({ behavior: "auto", block: "nearest" })
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user