Fix nullpointer issues

It seems that `this.$apollo.queries.Post` can be undefined sometimes.
Honestly I don't know why but I could imagine that it might happen on
subpages and when the cypress test triggers the infinite loader, we
face this bug.
This commit is contained in:
roschaefer 2019-09-05 11:52:19 +02:00
parent da57e9391c
commit 0fca14a29e
2 changed files with 8 additions and 8 deletions

View File

@ -125,12 +125,6 @@ export default {
return this.$apollo.loading || (this.posts && this.posts.length > 0)
},
},
watch: {
postsFilter() {
this.offset = 0
this.posts = []
},
},
methods: {
toggleOnlySorting(x) {
this.offset = 0
@ -149,8 +143,11 @@ export default {
}).href
},
showMoreContributions() {
const { Post: PostQuery } = this.$apollo.queries
if (!PostQuery) return // seems this can be undefined on subpages
this.offset += this.pageSize
this.$apollo.queries.Post.fetchMore({
PostQuery.fetchMore({
variables: {
offset: this.offset,
filter: this.finalFilters,

View File

@ -363,8 +363,11 @@ export default {
this.$apollo.queries.User.refetch()
},
showMoreContributions() {
const { Post: PostQuery } = this.$apollo.queries
if (!PostQuery) return // seems this can be undefined on subpages
this.offset += this.pageSize
this.$apollo.queries.Post.fetchMore({
PostQuery.fetchMore({
variables: {
offset: this.offset,
filter: this.filter,