This commit is contained in:
@@ -35,7 +35,10 @@ export default () => {
|
|||||||
...(withCursor && { cursor }) } })
|
...(withCursor && { cursor }) } })
|
||||||
const data = toCamel (res.data as any, { deep: true }) as { posts: Post[]
|
const data = toCamel (res.data as any, { deep: true }) as { posts: Post[]
|
||||||
nextCursor: string }
|
nextCursor: string }
|
||||||
setPosts (posts => [...(withCursor ? posts : []), ...data.posts])
|
setPosts (posts => (
|
||||||
|
[...((new Map ([...(withCursor ? posts : []), ...data.posts]
|
||||||
|
.map (post => [post.id, post])))
|
||||||
|
.values ())]))
|
||||||
setCursor (data.nextCursor)
|
setCursor (data.nextCursor)
|
||||||
|
|
||||||
setLoading (false)
|
setLoading (false)
|
||||||
@@ -79,7 +82,6 @@ export default () => {
|
|||||||
setPosts ([])
|
setPosts ([])
|
||||||
loadMore (false)
|
loadMore (false)
|
||||||
}
|
}
|
||||||
sessionStorage.removeItem ('posts')
|
|
||||||
|
|
||||||
setWikiPage (null)
|
setWikiPage (null)
|
||||||
if (tags.length === 1)
|
if (tags.length === 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user