Skip to content

Commit 7834d25

Browse files
authored
Merge pull request #139 from solid/load-storages-properly
Making sure that list of pods are loaded
2 parents 07625fc + d57f747 commit 7834d25

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

outline/manager.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,28 @@ module.exports = function (doc) {
314314
async function getDashboardItems () {
315315
const me = UI.authn.currentUser()
316316
const div = dom.createElement('div')
317+
const [books, pods] = await Promise.all([
318+
getAddressBooks(),
319+
getPods()
320+
])
317321
return [
318322
{ paneName: 'home', label: 'Your stuff', icon: UI.icons.iconBase + 'noun_547570.svg' },
319323
// TODO: Fix basicPreferences properly then reintroduce when ready
320324
// { paneName: 'basicPreferences', label: 'Preferences', icon: UI.icons.iconBase + 'noun_Sliders_341315_00000.svg' },
321325
{ paneName: 'trustedApplications', label: 'Trusted Apps', icon: UI.icons.iconBase + 'noun_15177.svg.svg' },
322326
{ paneName: 'editProfile', label: 'Edit your profile', icon: UI.icons.iconBase + 'noun_492246.svg' }
323327
]
324-
.concat(await getAddressBooks())
325-
.concat(getPods())
328+
.concat(books)
329+
.concat(pods)
326330

327-
function getPods () {
331+
async function getPods () {
332+
try {
333+
// need to make sure that profile is loaded
334+
await kb.fetcher.load(me.doc())
335+
} catch (err) {
336+
console.error('Unable to load profile', err)
337+
return []
338+
}
328339
const pods = kb.each(me, ns.space('storage'), null, me.doc())
329340
return pods.map((pod, index) => {
330341
let label = pods.length > 1 ? pod.uri.split('//')[1].slice(0, -1) : 'Your storage'

0 commit comments

Comments
 (0)