|
|
@@ -182,19 +182,18 @@ export default {
|
|
182
|
182
|
console.log(this.observer)
|
|
183
|
183
|
},
|
|
184
|
184
|
unsetIntersectionLoader() {
|
|
185
|
|
- try {
|
|
186
|
|
- const footerEl = document.querySelector(INTERSECT_SELECTOR)
|
|
187
|
|
- console.warn('unsetting intersection handler on:', footerEl, this.sortBy)
|
|
188
|
|
- this.observer.unobserve(footerEl)
|
|
189
|
|
- this.observer.disconnect()
|
|
190
|
|
- } catch (err) {
|
|
191
|
|
- console.error(`cannot unset intersection handler. Have you tried setting the el: ${footerEl} or observer: ${this.observer} ?\n`)
|
|
192
|
|
- console.error(`More info: ${err}`)
|
|
193
|
|
- }
|
|
|
185
|
+ const footerEl = document.querySelector(INTERSECT_SELECTOR)
|
|
|
186
|
+ if(!footerEl || !this.observer) return console.error(`cannot unset intersection handler missing el: ${footerEl} or observer: ${this.observer}`)
|
|
|
187
|
+
|
|
|
188
|
+ console.warn('unsetting intersection handler on:', footerEl, this.sortBy)
|
|
|
189
|
+ this.observer.unobserve(footerEl)
|
|
|
190
|
+ this.observer.disconnect()
|
|
194
|
191
|
return footerEl
|
|
195
|
192
|
},
|
|
196
|
|
- clearAndInitPostList() {
|
|
|
193
|
+ clearAndInitPostList(caller) {
|
|
|
194
|
+ console.log(`clearAndInitPostList from ${caller}...`)
|
|
197
|
195
|
console.log('---')
|
|
|
196
|
+
|
|
198
|
197
|
this.page = 0
|
|
199
|
198
|
this.keepFetching = true
|
|
200
|
199
|
|
|
|
@@ -214,14 +213,12 @@ export default {
|
|
214
|
213
|
type(newType, oldType) {
|
|
215
|
214
|
if(!postTypes.includes(newType)) return console.warn('type not found...')
|
|
216
|
215
|
|
|
217
|
|
- console.log('init from type watch...')
|
|
218
|
|
- this.clearAndInitPostList()
|
|
|
216
|
+ this.clearAndInitPostList('watcher')
|
|
219
|
217
|
}
|
|
220
|
218
|
},
|
|
221
|
219
|
mounted() {
|
|
222
|
220
|
// This only fires navigating from a single page, to a list page
|
|
223
|
|
- console.log('init from mounted...')
|
|
224
|
|
- this.clearAndInitPostList()
|
|
|
221
|
+ this.clearAndInitPostList('mounted')
|
|
225
|
222
|
},
|
|
226
|
223
|
beforeDestroy() {
|
|
227
|
224
|
this.unsetIntersectionLoader()
|