Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: can't refresh statuses after delete a status in account/index pa… #2547

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions composables/paginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export function usePaginator<T, P, U = T>(
_paginator: mastodon.Paginator<T[], P>,
stream: Ref<mastodon.streaming.Subscription | undefined>,
eventType: 'notification' | 'update' = 'update',

Check warning on line 8 in composables/paginator.ts

View workflow job for this annotation

GitHub Actions / ci

'eventType' is assigned a value but never used. Allowed unused vars must match /^_/u
preprocess: (items: (T | U)[]) => U[] = items => items as unknown as U[],
buffer = 10,
) {
Expand Down Expand Up @@ -62,6 +62,11 @@
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.user.subscribe())
</script>

<template>
<div>
<AccountTabs />
<TimelinePaginator :paginator="paginator" :preprocess="reorderAndFilter" context="account" :account="account" />
<TimelinePaginator :paginator="paginator" :preprocess="reorderAndFilter" context="account" :account="account" :stream="stream" />
HawtinZeng marked this conversation as resolved.
Show resolved Hide resolved
</div>
</template>
Loading