Skip to content

Commit

Permalink
fix: can't refresh statuses after delete a status in account/index pa…
Browse files Browse the repository at this point in the history
  • Loading branch information
zenghawtin committed Jan 6, 2024
1 parent 07042b9 commit 96fa823
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions composables/paginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function usePaginator<T, P, U = T>(
// called `next` method will mutate the internal state of the variable,
// and we need its initial state after HMR
// so clone it

const paginator = _paginator.clone()

const state = ref<PaginatorState>(isHydrated.value ? 'idle' : 'loading')
Expand Down Expand Up @@ -57,6 +58,11 @@ export function usePaginator<T, P, U = T>(
removeCachedStatus(id)

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)
if (index >= 0)
data.splice(index, 1)
Expand Down
3 changes: 2 additions & 1 deletion pages/[[server]]/@[account]/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ if (account) {
title: () => `${t('account.posts')} | ${getDisplayName(account)} (@${account.acct})`,
})
}
const stream = $(useStreaming(client => client.v1.stream.streamUser()))
</script>

<template>
<div>
<AccountTabs />
<TimelinePaginator :paginator="paginator" :preprocess="reorderAndFilter" context="account" :account="account" />
<TimelinePaginator :paginator="paginator" :preprocess="reorderAndFilter" context="account" :account="account" :stream="stream" />
</div>
</template>

0 comments on commit 96fa823

Please sign in to comment.