Merge pull request #2481 from Human-Connection/fix_cannot_read_post_of_undefined

Fix `Cannot read 'Post' of undefined`
This commit is contained in:
Robert Schäfer 2019-12-10 19:04:12 +01:00 committed by GitHub
commit 032242ac7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -157,10 +157,11 @@ export default {
$state.complete()
}
const { Post = [] } = previousResult
const result = {
...previousResult,
Post: [
...previousResult.Post.filter(prevPost => {
...Post.filter(prevPost => {
return (
fetchMoreResult.Post.filter(newPost => newPost.id === prevPost.id).length === 0
)

View File

@ -390,10 +390,11 @@ export default {
this.hasMore = false
$state.complete()
}
const { profilePagePosts = [] } = previousResult
const result = {
...previousResult,
profilePagePosts: [
...previousResult.profilePagePosts.filter(prevPost => {
...profilePagePosts.filter(prevPost => {
return (
fetchMoreResult.profilePagePosts.filter(newPost => newPost.id === prevPost.id)
.length === 0