fix: can't refresh statuses after delete a status in account/index page, #2546

This commit is contained in:
zenghawtin 2024-01-20 21:48:50 +08:00
parent cadf1b4a7c
commit f43317fd94
2 changed files with 7 additions and 1 deletions

View file

@ -62,6 +62,11 @@ export function usePaginator<T, P, U = T>(
removeCachedStatus(id) removeCachedStatus(id)
const data = items.value as mastodon.v1.Status[] const data = items.value as mastodon.v1.Status[]
const prevItemsIndex = prevItems.value.findIndex((i: any) => i.id === id)
if (prevItemsIndex >= 0)
prevItems.value.splice(prevItemsIndex, 1)
const index = data.findIndex(s => s.id === id) const index = data.findIndex(s => s.id === id)
if (index >= 0) if (index >= 0)
data.splice(index, 1) data.splice(index, 1)

View file

@ -21,11 +21,12 @@ if (account) {
title: () => `${t('account.posts')} | ${getDisplayName(account)} (@${account.acct})`, title: () => `${t('account.posts')} | ${getDisplayName(account)} (@${account.acct})`,
}) })
} }
const stream = useStreaming(client => client.user.subscribe())
</script> </script>
<template> <template>
<div> <div>
<AccountTabs /> <AccountTabs />
<TimelinePaginator :paginator="paginator" :preprocess="reorderAndFilter" context="account" :account="account" /> <TimelinePaginator :paginator="paginator" :preprocess="reorderAndFilter" context="account" :account="account" :stream="stream" />
</div> </div>
</template> </template>