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

fix: remove history state fallback + asyncdata (#687)

This commit is contained in:
Daniel Roe 2023-01-02 01:00:13 +01:00 committed by GitHub
parent 451c4a0701
commit 72ce43dde9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 19 deletions

View file

@ -15,7 +15,7 @@ const publishWidget = ref()
const { data: status, pending, refresh: refreshStatus } = useAsyncData( const { data: status, pending, refresh: refreshStatus } = useAsyncData(
`status:${id}`, `status:${id}`,
async () => (window.history.state?.status as Status | undefined) ?? await fetchStatus(id), () => fetchStatus(id),
{ watch: [isMastoInitialised], immediate: isMastoInitialised.value }, { watch: [isMastoInitialised], immediate: isMastoInitialised.value },
) )
const masto = useMasto() const masto = useMasto()

View file

@ -9,16 +9,13 @@ definePageMeta({ name: 'account-index' })
const { t } = useI18n() const { t } = useI18n()
const { data: account } = await useAsyncData(`account:${handle}`, async () => ( const account = await fetchAccountByHandle(handle)
window.history.state?.account as Account | undefined)
?? await fetchAccountByHandle(handle),
)
const paginator = useMasto().accounts.iterateStatuses(account.value!.id, { excludeReplies: true }) const paginator = useMasto().accounts.iterateStatuses(account.id, { excludeReplies: true })
if (account) { if (account) {
useHeadFixed({ useHeadFixed({
title: () => `${t('account.posts')} | ${getDisplayName(account.value!)} (@${account.value!.acct})`, title: () => `${t('account.posts')} | ${getDisplayName(account)} (@${account.acct})`,
}) })
} }
</script> </script>

View file

@ -7,16 +7,13 @@ const { t } = useI18n()
const params = useRoute().params const params = useRoute().params
const handle = $(computedEager(() => params.account as string)) const handle = $(computedEager(() => params.account as string))
const { data: account } = await useAsyncData(`account:${handle}`, async () => ( const account = await fetchAccountByHandle(handle)
window.history.state?.account as Account | undefined)
?? await fetchAccountByHandle(handle),
)
const paginator = useMasto().accounts.iterateStatuses(account.value!.id, { onlyMedia: true, excludeReplies: false }) const paginator = useMasto().accounts.iterateStatuses(account.id, { onlyMedia: true, excludeReplies: false })
if (account) { if (account) {
useHeadFixed({ useHeadFixed({
title: () => `${t('tab.media')} | ${getDisplayName(account.value!)} (@${account.value!.acct})`, title: () => `${t('tab.media')} | ${getDisplayName(account)} (@${account.acct})`,
}) })
} }
</script> </script>

View file

@ -7,16 +7,13 @@ const { t } = useI18n()
const params = useRoute().params const params = useRoute().params
const handle = $(computedEager(() => params.account as string)) const handle = $(computedEager(() => params.account as string))
const { data: account } = await useAsyncData(`account:${handle}`, async () => ( const account = await fetchAccountByHandle(handle)
window.history.state?.account as Account | undefined)
?? await fetchAccountByHandle(handle),
)
const paginator = useMasto().accounts.iterateStatuses(account.value!.id, { excludeReplies: false }) const paginator = useMasto().accounts.iterateStatuses(account.id, { excludeReplies: false })
if (account) { if (account) {
useHeadFixed({ useHeadFixed({
title: () => `${t('tab.posts_with_replies')} | ${getDisplayName(account.value!)} (@${account.value!.acct})`, title: () => `${t('tab.posts_with_replies')} | ${getDisplayName(account)} (@${account.acct})`,
}) })
} }
</script> </script>