Skip to content

Commit f805308

Browse files
committed
load container representation
1 parent a2a9d57 commit f805308

File tree

3 files changed

+41
-18
lines changed

3 files changed

+41
-18
lines changed

package-lock.json

Lines changed: 32 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
},
5454
"homepage": "https://github.com/solid/solid-ui",
5555
"dependencies": {
56-
"@mdx-js/react": "^2.1.1",
5756
"escape-html": "^1.0.3",
5857
"jss": "^10.9.0",
5958
"jss-preset-default": "^10.9.0",
@@ -74,6 +73,7 @@
7473
"@babel/preset-env": "^7.16.11",
7574
"@babel/preset-typescript": "^7.16.7",
7675
"@babel/runtime": "^7.17.8",
76+
"@mdx-js/react": "^2.1.1",
7777
"@storybook/addon-docs": "^6.4.19",
7878
"@storybook/addon-essentials": "^6.4.19",
7979
"@storybook/addon-links": "^6.4.19",

src/utils/headerFooterHelpers.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Copied from mashlib/src/global/metadata.ts
33
*/
4-
import { IndexedFormula, LiveStore, NamedNode, sym } from 'rdflib'
4+
import { IndexedFormula, LiveStore, NamedNode, parse, sym } from 'rdflib'
55
import { ns } from '..'
66
import { styleMap as headerStyleMap } from '../header/styleMap'
77
import { styleMap as footerStyleMap } from '../footer/styleMap'
@@ -48,8 +48,12 @@ export async function getPodOwner (pod: NamedNode, store: LiveStore): Promise<Na
4848
// const podOwner = sym(`${pod.uri}profile/card#me`)
4949
/* eslint-disable no-console */
5050
try {
51-
// @ts-ignore LiveStore always has fetcher
52-
store.fetcher.load(pod)
51+
// load turtle Container representation
52+
if (!store.any(pod, null, ns.ldp('Container'), pod)) {
53+
const response = await store.fetcher.webOperation('GET', pod.uri, store.fetcher.initFetchOptions(pod.uri, { headers: { accept: 'text/turtle' } }))
54+
const containerTurtle = response.responseText
55+
parse(containerTurtle as string, store, pod.uri, 'text/turtle')
56+
}
5357
} catch (err) {
5458
console.error('Error loading pod ' + pod + ': ' + err)
5559
return null
@@ -62,8 +66,7 @@ export async function getPodOwner (pod: NamedNode, store: LiveStore): Promise<Na
6266
store.any(null, ns.space('storage'), pod, pod)
6367
if (podOwner) {
6468
try {
65-
// @ts-ignore LiveStore always has fetcher
66-
store.fetcher.load(podOwner.doc())
69+
store.fetcher.load((podOwner as NamedNode).doc())
6770
} catch (err) {
6871
console.warn('Unable to load profile of pod owner ' + podOwner)
6972
return null

0 commit comments

Comments
 (0)