feat: scroll to status (#127)
Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
parent
e51ca06f97
commit
5c60497421
3 changed files with 9 additions and 2 deletions
|
@ -7,6 +7,13 @@ const main = ref<Component | null>(null)
|
|||
|
||||
const status = window.history.state?.status ?? await fetchStatus(id)
|
||||
const { data: context } = useAsyncData(`context:${id}`, () => masto.statuses.fetchContext(id))
|
||||
const unsubscribe = watch(context, async (context) => {
|
||||
if (context) {
|
||||
const statusElement = document.querySelector(`#status-${id}`)
|
||||
statusElement?.scrollIntoView()
|
||||
unsubscribe()
|
||||
}
|
||||
}, { flush: 'post' })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue