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