Remove observer code

This commit is contained in:
Sam Carlton 2022-05-19 14:46:18 -05:00
parent 3c68db2265
commit 2878c66c84

View file

@ -269,17 +269,11 @@ export default {
// appList, // appList,
query: '', query: '',
hasStartedAnyQuery: false, hasStartedAnyQuery: false,
observer: null,
seenItems: Object.fromEntries(this.appList.map(app => {
return [app.slug, false]
})),
// results: [],
titleStartsWithResults: [], titleStartsWithResults: [],
titleContainsResults: [], titleContainsResults: [],
categoryContainsResults: [], categoryContainsResults: [],
statusResults: [], statusResults: [],
storkResults: [], storkResults: [],
// store: overlayStore.state
} }
}, },
computed: { computed: {
@ -313,9 +307,6 @@ export default {
return this.query.split(/\s+/).filter(part => part.length > 0) return this.query.split(/\s+/).filter(part => part.length > 0)
}, },
}, },
beforeDestroy() {
this.observer.disconnect()
},
// watch: { // watch: {
// 'store.mode': function (newMode) { // 'store.mode': function (newMode) {
// // If we're showing the search // // If we're showing the search
@ -336,23 +327,6 @@ export default {
storkClient = new StorkClient() storkClient = new StorkClient()
console.log('storkClient', storkClient) console.log('storkClient', storkClient)
this.observer = new IntersectionObserver(this.onElementObserved, {
// root: this.$el,
threshold: 1.0,
})
// Start observing all search rows
this.initialList.forEach(app => {
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])
})
}, },
methods: { methods: {
makeHighlightedMarkup, makeHighlightedMarkup,
@ -532,21 +506,6 @@ export default {
behavior: 'smooth' behavior: 'smooth'
}) })
}, },
onElementObserved(entries) {
entries.forEach(({ target, isIntersecting }) => {
if (!isIntersecting) {
return
}
this.observer.unobserve(target)
// console.log('Observed target', target)
const appSlug = target.getAttribute('data-app-slug')
this.seenItems[appSlug] = true
});
},
async queryResults (rawQuery) { async queryResults (rawQuery) {
// Clear any results from before // Clear any results from before
this.titleStartsWithResults = [] this.titleStartsWithResults = []
@ -560,18 +519,10 @@ export default {
this.$emit('update:query', rawQuery) this.$emit('update:query', rawQuery)
// If our query is empty // If our query is empty
// then bail // then bail
if (rawQuery.length === 0) return if (rawQuery.length === 0) return
// Separate status filters from the actual query text
// const [
// statusText,
// query
// ] = this.filterStatusFromText(rawQuery.toLowerCase())
// Declare that at least one query has been made // Declare that at least one query has been made
this.hasStartedAnyQuery = true this.hasStartedAnyQuery = true