Skip to content

Commit

Permalink
Fix reference error on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
arj03 committed Nov 25, 2021
1 parent 09240ac commit f40f537
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions ssb-profile-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,39 @@ Vue.component('ssb-profile-link', {
self.mainfeed = feedToMainCache[self.feed]
self.load()
} else {
const { where, author, slowEqual, toPullStream } = SSB.db.operators

pull(
SSB.db.query(
where(slowEqual('value.content.subfeed', self.feed)),
toPullStream()
),
pull.collect((err, messages) => {
if (err) return console.error(err)
if (messages.length === 0) return

const { metafeed } = messages[0].value.content
ssbSingleton.getSimpleSSBEventually(
() => { return self.componentStillLoaded },
() => {
const { where, author, slowEqual, toPullStream } = SSB.db.operators

pull(
SSB.db.query(
where(author(metafeed)),
where(slowEqual('value.content.subfeed', self.feed)),
toPullStream()
),
pull.filter((msg) => msg.value.content.feedpurpose === 'main'),
pull.collect((err, messages) => {
if (err || messages.length == 0) return console.error(err)

self.mainfeed = messages[0].value.content.subfeed
feedToMainCache[self.feed] = self.mainfeed
self.load()
if (err) return console.error(err)
if (messages.length === 0) return

const { metafeed } = messages[0].value.content

pull(
SSB.db.query(
where(author(metafeed)),
toPullStream()
),
pull.filter((msg) => msg.value.content.feedpurpose === 'main'),
pull.collect((err, messages) => {
if (err || messages.length == 0) return console.error(err)

self.mainfeed = messages[0].value.content.subfeed
feedToMainCache[self.feed] = self.mainfeed
self.load()
})
)
})
)
})
}
)
}
}
Expand Down

0 comments on commit f40f537

Please sign in to comment.