mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Fixed #19
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { InfiniteData, QueryClient } from 'react-query'
|
||||
import { QueryKeyTimeline } from '../timeline'
|
||||
import { QueryKeyTimeline, TimelineData } from '../timeline'
|
||||
|
||||
const deleteItem = ({
|
||||
queryClient,
|
||||
@ -10,16 +10,15 @@ const deleteItem = ({
|
||||
queryKey: QueryKeyTimeline
|
||||
id: Mastodon.Status['id']
|
||||
}) => {
|
||||
queryClient.setQueryData<InfiniteData<Mastodon.Conversation[]> | undefined>(
|
||||
queryKey,
|
||||
old => {
|
||||
if (old) {
|
||||
old.pages = old.pages.map(page => page.filter(item => item.id !== id))
|
||||
}
|
||||
|
||||
queryClient.setQueryData<InfiniteData<any> | undefined>(queryKey, old => {
|
||||
if (old) {
|
||||
old.pages = old.pages.map(page => {
|
||||
page.body = page.body.filter((item: Mastodon.Status) => item.id !== id)
|
||||
return page
|
||||
})
|
||||
return old
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
export default deleteItem
|
||||
|
Reference in New Issue
Block a user