Merge pull request #220 from h3poteto/fix/lazyloading/error
Handle error when lazy loading
This commit is contained in:
commit
b3c3768a8d
|
@ -57,6 +57,12 @@ export default {
|
||||||
onScroll (event) {
|
onScroll (event) {
|
||||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('favourites').clientHeight - 10) && !this.lazyloading) {
|
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])
|
this.$store.dispatch('TimelineSpace/Contents/Favourites/lazyFetchFavourites', this.favourites[this.favourites.length - 1])
|
||||||
|
.catch(() => {
|
||||||
|
this.$message({
|
||||||
|
message: 'Could not fetch favourites',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,12 @@ export default {
|
||||||
onScroll (event) {
|
onScroll (event) {
|
||||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('home').clientHeight - 10) && !this.lazyloading) {
|
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])
|
this.$store.dispatch('TimelineSpace/Contents/Home/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
|
||||||
|
.catch(() => {
|
||||||
|
this.$message({
|
||||||
|
message: 'Could not fetch home timeline',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,12 @@ export default {
|
||||||
onScroll (event) {
|
onScroll (event) {
|
||||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('local').clientHeight - 10) && !this.lazyloading) {
|
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])
|
this.$store.dispatch('TimelineSpace/Contents/Local/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
|
||||||
|
.catch(() => {
|
||||||
|
this.$message({
|
||||||
|
message: 'Could not fetch timeline',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,12 @@ export default {
|
||||||
onScroll (event) {
|
onScroll (event) {
|
||||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('notifications').clientHeight - 10) && !this.lazyloading) {
|
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])
|
this.$store.dispatch('TimelineSpace/Contents/Notifications/lazyFetchNotifications', this.notifications[this.notifications.length - 1])
|
||||||
|
.catch(() => {
|
||||||
|
this.$message({
|
||||||
|
message: 'Could not fetch notification',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,12 @@ export default {
|
||||||
onScroll (event) {
|
onScroll (event) {
|
||||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('public').clientHeight - 10) && !this.lazyloading) {
|
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])
|
this.$store.dispatch('TimelineSpace/Contents/Public/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
|
||||||
|
.catch(() => {
|
||||||
|
this.$message({
|
||||||
|
message: 'Could not fetch timeline',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,9 @@ const Favourites = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
lazyFetchFavourites ({ state, commit, rootState }, last) {
|
lazyFetchFavourites ({ state, commit, rootState }, last) {
|
||||||
|
if (last === undefined || last === null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (state.lazyLoading) {
|
if (state.lazyLoading) {
|
||||||
return resolve()
|
return resolve()
|
||||||
|
|
|
@ -12,6 +12,9 @@ const Home = {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
lazyFetchTimeline ({ state, commit, rootState }, last) {
|
lazyFetchTimeline ({ state, commit, rootState }, last) {
|
||||||
|
if (last === undefined || last === null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (state.lazyLoading) {
|
if (state.lazyLoading) {
|
||||||
return resolve()
|
return resolve()
|
||||||
|
|
|
@ -70,6 +70,9 @@ const Local = {
|
||||||
ipcRenderer.send('stop-local-streaming')
|
ipcRenderer.send('stop-local-streaming')
|
||||||
},
|
},
|
||||||
lazyFetchTimeline ({ state, commit, rootState }, last) {
|
lazyFetchTimeline ({ state, commit, rootState }, last) {
|
||||||
|
if (last === undefined || last === null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (state.lazyLoading) {
|
if (state.lazyLoading) {
|
||||||
return resolve()
|
return resolve()
|
||||||
|
|
|
@ -12,6 +12,9 @@ const Notifications = {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
lazyFetchNotifications ({ state, commit, rootState }, last) {
|
lazyFetchNotifications ({ state, commit, rootState }, last) {
|
||||||
|
if (last === undefined || last === null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (state.lazyLoading) {
|
if (state.lazyLoading) {
|
||||||
return resolve()
|
return resolve()
|
||||||
|
|
|
@ -70,6 +70,9 @@ const Public = {
|
||||||
ipcRenderer.send('stop-public-streaming')
|
ipcRenderer.send('stop-public-streaming')
|
||||||
},
|
},
|
||||||
lazyFetchTimeline ({ state, commit, rootState }, last) {
|
lazyFetchTimeline ({ state, commit, rootState }, last) {
|
||||||
|
if (last === undefined || last === null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (state.lazyLoading) {
|
if (state.lazyLoading) {
|
||||||
return resolve()
|
return resolve()
|
||||||
|
|
Loading…
Reference in New Issue