Merge pull request #220 from h3poteto/fix/lazyloading/error

Handle error when lazy loading
This commit is contained in:
AkiraFukushima 2018-04-14 22:18:58 +09:00 committed by GitHub
commit b3c3768a8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 0 deletions

View File

@ -57,6 +57,12 @@ export default {
onScroll (event) {
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('favourites').clientHeight - 10) && !this.lazyloading) {
this.$store.dispatch('TimelineSpace/Contents/Favourites/lazyFetchFavourites', this.favourites[this.favourites.length - 1])
.catch(() => {
this.$message({
message: 'Could not fetch favourites',
type: 'error'
})
})
}
}
}

View File

@ -41,6 +41,12 @@ export default {
onScroll (event) {
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('home').clientHeight - 10) && !this.lazyloading) {
this.$store.dispatch('TimelineSpace/Contents/Home/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
.catch(() => {
this.$message({
message: 'Could not fetch home timeline',
type: 'error'
})
})
}
}
}

View File

@ -70,6 +70,12 @@ export default {
onScroll (event) {
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('local').clientHeight - 10) && !this.lazyloading) {
this.$store.dispatch('TimelineSpace/Contents/Local/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
.catch(() => {
this.$message({
message: 'Could not fetch timeline',
type: 'error'
})
})
}
}
}

View File

@ -41,6 +41,12 @@ export default {
onScroll (event) {
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('notifications').clientHeight - 10) && !this.lazyloading) {
this.$store.dispatch('TimelineSpace/Contents/Notifications/lazyFetchNotifications', this.notifications[this.notifications.length - 1])
.catch(() => {
this.$message({
message: 'Could not fetch notification',
type: 'error'
})
})
}
}
}

View File

@ -70,6 +70,12 @@ export default {
onScroll (event) {
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('public').clientHeight - 10) && !this.lazyloading) {
this.$store.dispatch('TimelineSpace/Contents/Public/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
.catch(() => {
this.$message({
message: 'Could not fetch timeline',
type: 'error'
})
})
}
}
}

View File

@ -50,6 +50,9 @@ const Favourites = {
})
},
lazyFetchFavourites ({ state, commit, rootState }, last) {
if (last === undefined || last === null) {
return null
}
return new Promise((resolve, reject) => {
if (state.lazyLoading) {
return resolve()

View File

@ -12,6 +12,9 @@ const Home = {
},
actions: {
lazyFetchTimeline ({ state, commit, rootState }, last) {
if (last === undefined || last === null) {
return null
}
return new Promise((resolve, reject) => {
if (state.lazyLoading) {
return resolve()

View File

@ -70,6 +70,9 @@ const Local = {
ipcRenderer.send('stop-local-streaming')
},
lazyFetchTimeline ({ state, commit, rootState }, last) {
if (last === undefined || last === null) {
return null
}
return new Promise((resolve, reject) => {
if (state.lazyLoading) {
return resolve()

View File

@ -12,6 +12,9 @@ const Notifications = {
},
actions: {
lazyFetchNotifications ({ state, commit, rootState }, last) {
if (last === undefined || last === null) {
return null
}
return new Promise((resolve, reject) => {
if (state.lazyLoading) {
return resolve()

View File

@ -70,6 +70,9 @@ const Public = {
ipcRenderer.send('stop-public-streaming')
},
lazyFetchTimeline ({ state, commit, rootState }, last) {
if (last === undefined || last === null) {
return null
}
return new Promise((resolve, reject) => {
if (state.lazyLoading) {
return resolve()