Fix trying to observe elements not rendered

This commit is contained in:
Sam Carlton 2020-11-28 15:43:04 -06:00
parent fd63c02e2a
commit 295284c53f

View file

@ -246,10 +246,11 @@ export default {
} }
}, },
computed: { computed: {
initialList () {
return this.initialLimit !== null ? this.appList.slice(0, this.initialLimit) : this.appList
},
results () { results () {
if (!this.hasSearchInputText) { if (!this.hasSearchInputText) return this.initialList
return this.initialLimit !== null ? this.appList.slice(0, this.initialLimit) : this.appList
}
return [ return [
...this.titleStartsWithResults, ...this.titleStartsWithResults,
@ -302,12 +303,17 @@ export default {
}) })
// Start observing all search rows // Start observing all search rows
this.appList.forEach(app => { this.initialList.forEach(app => {
// console.log('this.$refs[`${app.slug}-row`]', this.$refs[`${app.slug}-row`][0]) if (this.$refs.hasOwnProperty(`${app.slug}-row`) === false) {
console.log('App Row not found', app)
return
}
// console.log('this.$refs[`${app.slug}-row`]', this.$refs[`${app.slug}-row`])
this.observer.observe(this.$refs[`${app.slug}-row`][0]) this.observer.observe(this.$refs[`${app.slug}-row`][0])
}) })
console.log('appList', this.appList.length) console.log('this.initialList', this.initialList.length)
}, },
methods: { methods: {
getAppCategory, getAppCategory,